Closed JMF141114 closed 4 years ago
Traceback (most recent call last): File "run_cnn.py", line 199, in train() File "run_cnn.py", line 80, in train x_train, y_train = process_file(train_dir, word_to_id, cat_to_id, config.seq_length) File "E:\Pycharm2017\毕设文本分类\text-classification-cnn-rnn-master\data\cnews_loader.py", line 107, in process_file label_id.append(cat_to_id[labels[i]]) KeyError: '一般缺陷 '
做数据集的时候分类标签与内容之间是一个制表符\t,但是总是出现问题诶
请问你后来是怎么解决的
Traceback (most recent call last): File "run_cnn.py", line 199, in train() File "run_cnn.py", line 80, in train x_train, y_train = process_file(train_dir, word_to_id, cat_to_id, config.seq_length) File "E:\Pycharm2017\毕设文本分类\text-classification-cnn-rnn-master\data\cnews_loader.py", line 107, in process_file label_id.append(cat_to_id[labels[i]]) KeyError: '一般缺陷 ' 做数据集的时候分类标签与内容之间是一个制表符\t,但是总是出现问题诶
请问你后来是怎么解决的
用notepad++对照原数据集重新刷一下数据集吧,可能数据集某个地方出错了
Traceback (most recent call last): File "run_cnn.py", line 199, in train() File "run_cnn.py", line 80, in train x_train, y_train = process_file(train_dir, word_to_id, cat_to_id, config.seq_length) File "E:\Pycharm2017\毕设文本分类\text-classification-cnn-rnn-master\data\cnews_loader.py", line 107, in process_file label_id.append(cat_to_id[labels[i]]) KeyError: '一般缺陷 ' 做数据集的时候分类标签与内容之间是一个制表符\t,但是总是出现问题诶
请问你后来是怎么解决的
用notepad++对照原数据集重新刷一下数据集吧,可能数据集某个地方出错了
谢谢你 我昨天已解决 是数据集的问题 、
Traceback (most recent call last): File "run_cnn.py", line 199, in
train()
File "run_cnn.py", line 80, in train
x_train, y_train = process_file(train_dir, word_to_id, cat_to_id, config.seq_length)
File "E:\Pycharm2017\毕设文本分类\text-classification-cnn-rnn-master\data\cnews_loader.py", line 107, in process_file
label_id.append(cat_to_id[labels[i]])
KeyError: '一般缺陷 '
做数据集的时候分类标签与内容之间是一个制表符\t,但是总是出现问题诶