Pretrained-Show-and-Tell-model icon indicating copy to clipboard operation
Pretrained-Show-and-Tell-model copied to clipboard

unable to run

Open ankush-06 opened this issue 7 years ago • 11 comments

I'm getting following error

ankush@Lenovo:/media/Study/Projects/showandtell/models/im2txt$ bazel-bin/im2txt/run_inference --checkpoint_path=${CHECKPOINT_PATH} --vocab_file=${VOCAB_FILE} --input_files=${IMAGE_FILE} INFO:tensorflow:Building model. INFO:tensorflow:Initializing vocabulary from file: Traceback (most recent call last): File "/media/ankush/Study/Projects/showandtell/models/im2txt/bazel-bin/im2txt/run_inference.runfiles/im2txt/im2txt/run_inference.py", line 85, in tf.app.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "/media/ankush/Study/Projects/showandtell/models/im2txt/bazel-bin/im2txt/run_inference.runfiles/im2txt/im2txt/run_inference.py", line 55, in main vocab = vocabulary.Vocabulary(FLAGS.vocab_file) File "/media/ankush/Study/Projects/showandtell/models/im2txt/bazel-bin/im2txt/run_inference.runfiles/im2txt/im2txt/inference_utils/vocabulary.py", line 50, in init assert start_word in reverse_vocab AssertionError

ankush-06 avatar Jun 20 '17 04:06 ankush-06

@ankush-06 Where did you place the checkpoint files? Can you run ls -l --block-size=K in your Pretrained-Show-and-Tell-model folder? Also, please share the full error log. It seems to have been truncated here.

KranthiGV avatar Jun 20 '17 05:06 KranthiGV

Thanks for replying so soon. This is the result i got. Here are some screenshots. https://image.ibb.co/mfGza5/1.png https://image.ibb.co/da0E8Q/2.png

ankush@Lenovo:/media/ankush/Study/Projects/showandtell/models/im2txt/Pretrained-Show-and-Tell-model$ ls -l --block-size=K total 297528K drwxrwxrwx 1 ankush ankush 0K Jun 20 05:56 extras -rwxrwxrwx 1 ankush ankush 6334K Oct 1 2016 image.jpg -rwxrwxrwx 1 ankush ankush 2K Jun 20 05:56 LICENSE -rwxrwxrwx 1 ankush ankush 145511K Jun 20 10:24 model.ckpt-1000000.data-00000-of-00001 -rwxrwxrwx 1 ankush ankush 17K Jun 20 05:56 model.ckpt-1000000.index -rwxrwxrwx 1 ankush ankush 145511K Jun 20 05:55 model.ckpt-2000000.data-00000-of-00001 -rwxrwxrwx 1 ankush ankush 17K Jun 20 05:56 model.ckpt-2000000.index -rwxrwxrwx 1 ankush ankush 4K Jun 20 05:56 README.md -rwxrwxrwx 1 ankush ankush 120K Jun 20 10:48 word_counts.txt

ankush-06 avatar Jun 20 '17 05:06 ankush-06

This seems to be okay. Can you share your full error log (the previous one was truncated)? Which tensorflow version are you using?

KranthiGV avatar Jun 20 '17 05:06 KranthiGV

I'm using ubuntu 16.04, python 2, tensorflow 1.2.0 Here is a screenshot of the error

https://image.ibb.co/dvSY2k/3.png

ankush-06 avatar Jun 20 '17 06:06 ankush-06

Seems like there's an issue with the word vocabulary. Are you using the word_counts.txt file given here? Run cat word_counts.txt | head.

KranthiGV avatar Jun 20 '17 06:06 KranthiGV

https://image.ibb.co/hc6Ahk/4.png ashish@Ashish-Lenovo:/media/ashish/Study/Academics/BTP/Projects/showandtell/models/im2txt/Pretrained-Show-and-Tell-model$ cat word_counts.txt | head a 969108 <S> 586368 </S> 586368 . 440479 on 213612 of 202290 the 196219 in 182598 with 152984 and 139109

I think i'm not able to load "word_counts.txt" file properly because when i tried to print reverse_vocab it gave me an empty list.

ankush-06 avatar Jun 20 '17 06:06 ankush-06

i solved the problem, but results are not accurate. Any suggestions to improve performance ?

ankush-06 avatar Jun 21 '17 06:06 ankush-06

Can you try the 1M like mentioned here? Keep us updated on that thread. :smile: Closing this issue because it's solved.

Update: @ankush-06 Can you let us know how you solved it? Would love to document it. (Reopened until then)

KranthiGV avatar Jun 22 '17 02:06 KranthiGV

To be really honest, i could'n really solved that issue :) but i somewhat overcame that. The problem was that the program was not able to locate the "word_counts.txt" file. I tried everything. I was getting frustated. So, i ran the commands in a separate python file("xxx.py"):

with tf.gfile.GFile("word_counts.txt") as f: word_map = list(f.readlines()) word_map = [line.split()[0] for line in word_map]

then i imported this word_map list in the vocabulary.py file. from xxx import word_map reverse_vocab = word_map

Also i had to install tensorflow==1.0 version. In versions > 1.0, i was having problems.

ankush-06 avatar Jun 22 '17 03:06 ankush-06

@ankush-06 how to solve it. I also encountered the same problem. Can teach me how to solve it?

chih-hong avatar Jan 11 '19 09:01 chih-hong

1547198048621

I also encountered the same problem.

chih-hong avatar Jan 14 '19 10:01 chih-hong