简体   繁体   中英

ParseError 1:1 Using Tensorflow with Bazel

System information

Running Python 3.6.4 on Windows

Describe the problem

I'm trying to run Tensorflow's lm_1b on sample mode, by inputting:

$ bazel-bin/lm_1b/lm_1b_eval --mode sample --prefix "I love that I" --pbtxt data/vocab-2016-09-10.txt --vocab_file data/vocab-2016-09-10.txt --ckpt 'data/ckpt-*'

But I get the error:

google.protobuf.text_format.ParseError: 1:1 : Expected identifier or number, got <. Any help would really be appreciated

Source code / logs

Recovering graph. Traceback (most recent call last): File "\\\\?\\C:\\Users\\snmsa\\AppData\\Local\\Temp\\Bazel.runfiles_9sq54ngc\\runfiles\\__main__\\lm_1b\\lm_1b_eval.py", line 308, in <module> tf.app.run() File "C:\\Users\\snmsa\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\platform\\app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "\\\\?\\C:\\Users\\snmsa\\AppData\\Local\\Temp\\Bazel.runfiles_9sq54ngc\\runfiles\\__main__\\lm_1b\\lm_1b_eval.py", line 298, in main _SampleModel(FLAGS.prefix, vocab) File "\\\\?\\C:\\Users\\snmsa\\AppData\\Local\\Temp\\Bazel.runfiles_9sq54ngc\\runfiles\\__main__\\lm_1b\\lm_1b_eval.py", line 174, in _SampleModel sess, t = _LoadModel(FLAGS.pbtxt, FLAGS.ckpt) File "\\\\?\\C:\\Users\\snmsa\\AppData\\Local\\Temp\\Bazel.runfiles_9sq54ngc\\runfiles\\__main__\\lm_1b\\lm_1b_eval.py", line 89, in _LoadModel text_format.Merge(s, gd) File "C:\\Users\\snmsa\\Anaconda3\\lib\\site-packages\\google\\protobuf\\text_format.py", line 533, in Merge descriptor_pool=descriptor_pool) File "C:\\Users\\snmsa\\Anaconda3\\lib\\site-packages\\google\\protobuf\\text_format.py", line 587, in MergeLines return parser.MergeLines(lines, message) File "C:\\Users\\snmsa\\Anaconda3\\lib\\site-packages\\google\\protobuf\\text_format.py", line 620, in MergeLines self._ParseOrMerge(lines, message) File "C:\\Users\\snmsa\\Anaconda3\\lib\\site-packages\\google\\protobuf\\text_format.py", line 635, in _ParseOrMerge self._MergeField(tokenizer, message) File "C:\\Users\\snmsa\\Anaconda3\\lib\\site-packages\\google\\protobuf\\text_format.py", line 679, in _MergeField name = tokenizer.ConsumeIdentifierOrNumber() File "C:\\Users\\snmsa\\Anaconda3\\lib\\site-packages\\google\\protobuf\\text_format.py", line 1152, in ConsumeIdentifierOrNumber raise self.ParseError('Expected identifier or number, got %s.' % result) google.protobuf.text_format.ParseError: 1:1 : Expected identifier or number, got <.

Your command line is wrong. It should be:

bazel-bin/lm_1b/lm_1b_eval --mode sample \
                           --prefix "I love that I" \
                           --pbtxt data/graph-2016-09-10.pbtxt \
                           ...

You are passing a vocabulary file --pbtxt data/vocab-2016-09-10.txt where a serialized GraphDef file is expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM