ryankiros / skip-thoughts

Sent2Vec encoder and training code from the paper "Skip-Thought Vectors"
2.05k stars 544 forks source link

python3 compatibility #53

Open ca-joe-yang opened 7 years ago

weiwancheng commented 7 years ago

I run this code on python3, and I get a error,plaese help me.

Traceback (most recent call last): File "G:/postgradute_learn/01code/text-to-image-master/generate_thought_vectors.py", line 33, in main() File "G:/postgradute_learn/01code/text-to-image-master/generate_thought_vectors.py", line 23, in main model = skipthoughts.load_model() File "G:\postgradute_learn\01code\text-to-image-master\skipthoughts.py", line 64, in load_model utable, btable = load_tables() File "G:\postgradute_learn\01code\text-to-image-master\skipthoughts.py", line 87, in load_tables utable = numpy.load(path_to_tables + 'utable.npy', encoding='latin1') File "C:\Users\Administrator\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 406, in load pickle_kwargs=pickle_kwargs) File "C:\Users\Administrator\Anaconda3\lib\site-packages\numpy\lib\format.py", line 637, in read_array array = pickle.load(fp, **pickle_kwargs) EOFError: Ran out of input

ca-joe-yang commented 7 years ago

I am sorry, I don't think you're running the same code version as the one I posted here. This is a slightly modified skipthought.py which should be able to run in python3. The original one (master branch) can only run in python2. I think you should start a new issue.

Despite this, I think the problem here is that you pickle loaded an empty file. Similar problem can be found here: https://stackoverflow.com/questions/24791987/why-do-i-get-pickle-eoferror-ran-out-of-input-reading-an-empty-file

I think you should check what the variable 'path_to_tables' really is, perhaps print the variable out. Also check whether the file path_to_tables + 'utable.npy' exists or not.

weiwancheng commented 7 years ago

Thank you for your reply. I have found the couse of the error. because utable.npy file has gone bad,so load have an error. I download it again, it can work. Anyway, thank you for your contribution.