Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行python run_cnn.py trains时出错 #110

Open
jiaqiyu543 opened this issue Feb 27, 2019 · 4 comments
Open

运行python run_cnn.py trains时出错 #110

jiaqiyu543 opened this issue Feb 27, 2019 · 4 comments

Comments

@jiaqiyu543
Copy link

Configuring CNN model...
Configuring TensorBoard and Saver...
Loading training and validation data...
Traceback (most recent call last):
File "run_cnn.py", line 198, 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 "/home/niko/Desktop/text-classification-cnn-rnn-master/data/cnews_loader.py", line 107, in process_file
label_id.append(cat_to_id[labels[i]])
KeyError: 'NHS1\x000\x00p\x0cVeY\x1f(WeYSO-N_\x16Y:W~ve\x19P\x0c)Y1\/f4llv\x0c\x14lab>f:yS_)Y\x0bNHSl31\'

@yichengye310
Copy link

I guess you will need to update /home/niko/Desktop/text-classification-cnn-rnn-master/data/cnews_loader.py with your own labels.

@SevenMpp
Copy link

SevenMpp commented Apr 5, 2019

请问你这个问题 解决啦嘛 我总是遇到 Traceback (most recent call last):
File "run_cnn.py", line 16, in
from data_process import read_vocab, read_category, batch_iter, process_file, build_vocab
File "F:\Tools\test\cnn_class\data_process.py", line 145, in
process_file(train_dir,word,cut,max_length=600)
File "F:\Tools\test\cnn_class\data_process.py", line 115, in process_file
label_id.append(cat_to_id[labels[i]])
KeyError: '体育'

@JMF141114
Copy link

请问你这个问题 解决啦嘛 我总是遇到 Traceback (most recent call last):
File "run_cnn.py", line 16, in
from data_process import read_vocab, read_category, batch_iter, process_file, build_vocab
File "F:\Tools\test\cnn_class\data_process.py", line 145, in
process_file(train_dir,word,cut,max_length=600)
File "F:\Tools\test\cnn_class\data_process.py", line 115, in process_file
label_id.append(cat_to_id[labels[i]])
KeyError: '体育'

你的解决了吗?我也遇到这个问题了

@Gingmzmzx
Copy link

请问你这个问题 解决啦嘛 我总是遇到 Traceback (most recent call last): File "run_cnn.py", line 16, in from data_process import read_vocab, read_category, batch_iter, process_file, build_vocab File "F:\Tools\test\cnn_class\data_process.py", line 145, in process_file(train_dir,word,cut,max_length=600) File "F:\Tools\test\cnn_class\data_process.py", line 115, in process_file label_id.append(cat_to_id[labels[i]]) KeyError: '体育'

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants