点此进入CSDN

点此添加QQ好友 加载失败时会显示




上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 23 下一页
摘要: import os file_path = os.path.dirname(__file__) os.path.exists(test_file.txt) 阅读全文
posted @ 2020-02-20 20:53 高颜值的殺生丸 阅读(797) 评论(0) 推荐(0) 编辑
摘要: out.squeeze(dim=1) out.squeeze_(dim=1) 阅读全文
posted @ 2020-02-20 18:14 高颜值的殺生丸 阅读(1265) 评论(0) 推荐(0) 编辑
摘要: 数据格式:分词后的句子+\t__label__+标签 fasttext_model.py from fasttext import FastText import numpy as np def get_data_path(by_word=True,train=True): if by_word: 阅读全文
posted @ 2020-02-20 00:05 高颜值的殺生丸 阅读(1389) 评论(0) 推荐(0) 编辑
摘要: cut_sentence.py import string import jieba import jieba.posseg as psg import logging #关闭jieba日制 jieba.setLogLevel(logging.INFO) jieba.load_userdict(". 阅读全文
posted @ 2020-02-19 22:43 高颜值的殺生丸 阅读(1570) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-02-19 17:32 高颜值的殺生丸 阅读(1051) 评论(0) 推荐(0) 编辑
摘要: 按下图顺序搭建以及执行 阅读全文
posted @ 2020-02-18 15:07 高颜值的殺生丸 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 先运行main.py进行文本序列化,再train.py模型训练 dataset.py from torch.utils.data import DataLoader,Dataset import torch import os from utils import tokenlize import c 阅读全文
posted @ 2020-02-18 10:15 高颜值的殺生丸 阅读(3146) 评论(0) 推荐(0) 编辑
摘要: 文本情感分类: 文本情感分类采用LSTM的最后一层输出 比如双层的LSTM,使用正向的最后一层和反向的最后一层进行拼接 def forward(self,input): ''' :param input: :return: ''' input_embeded = self.embedding(inp 阅读全文
posted @ 2020-02-18 10:09 高颜值的殺生丸 阅读(526) 评论(0) 推荐(0) 编辑
摘要: cd C:\Program Files\NVIDIA Corporation\NVSMI nvidia-smi 当batch_size设置越大的时候,GPU加速越明显,但是batch_size设置太大的话,会影响训练效果 阅读全文
posted @ 2020-02-17 23:12 高颜值的殺生丸 阅读(1088) 评论(0) 推荐(0) 编辑
摘要: 单向LSTM import torch.nn as nn import torch seq_len = 20 batch_size = 64 embedding_dim = 100 num_embeddings = 300 hidden_size = 128 number_layer = 3 inp 阅读全文
posted @ 2020-02-17 18:31 高颜值的殺生丸 阅读(2237) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 23 下一页

作者信息

昵称:

刘新宇

园龄:4年6个月


粉丝:1209


QQ:522414928