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

No such file or directory error #16

Closed
lydemo opened this issue Aug 24, 2017 · 3 comments
Closed

No such file or directory error #16

lydemo opened this issue Aug 24, 2017 · 3 comments

Comments

@lydemo
Copy link

lydemo commented Aug 24, 2017

I try to run p7_TextCNN_train.py in a02_TextCNN, and I've downloaded the zhihu-word2vec-title-desc.bin-100 and put it in the same place as p7_TextCNN_train.py, then the error occurs: [Errno 2] No such file or directory: 'cache_vocabulary_label_pik/cnn2_word_voabulary.pik'
I've noticed that someone met almost the same problem as me, but I don't understand now that cnn2_word_voabulary.pik does not exist, how can the program utilize it? I can't figure out how to debug it. Should I update somewhere in the program?

@brightmart
Copy link
Owner

  1. first you should create a folder name: "cache_vocabulary_label_pik".
  2. cnn2_word_voabulary.pik will be created under a function create_voabulary at data_util_zhihu.py. you can see from the code that it will be created if it is not exist; otherwise, it will be used.

@lydemo
Copy link
Author

lydemo commented Aug 25, 2017

Then another error occurs:
Traceback (most recent call last):
File "E:/test/text_classification-master/text_classification-master/a02_TextCNN/p7_TextCNN_train.py", line 197, in
tf.app.run()
File "E:\Anaconda\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "E:/test/text_classification-master/text_classification-master/a02_TextCNN/p7_TextCNN_train.py", line 48, in main
vocabulary_word2index, vocabulary_index2word = create_voabulary(word2vec_model_path=FLAGS.word2vec_model_path,name_scope="cnn2") #simple='simple'
File "E:\test\text_classification-master\text_classification-master\aa1_data_util\data_util_zhihu.py", line 18, in create_voabulary
vocabulary_word2index, vocabulary_index2word=pickle.load(data_f)
TypeError: a bytes-like object is required, not 'str'
cache_path: cache_vocabulary_label_pik/cnn2_word_voabulary.pik file_exists: True

I know it's caused by pickle, but how to fix the error?

@brightmart
Copy link
Owner

you may paas file object to pikle.load, not a file name or path.

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

2 participants