koth/kcws

标注模型执行freeze_graph.py脚本出错

ramblerSY opened this issue · 1 comments

使用freeze_graph.py脚本来生成pos_model.pbtxt ,命令如下:python tools/freeze_graph.py --input_graph pos_logs/graph.pbtxt --input_checkpoint pos_logs/model.ckpt --output_node_names "transitions,Reshape_9" --output_graph kcws/models/pos_model.pbtxt

当执行以上命令时,抛错:

Traceback (most recent call last):
File "tools/freeze_graph.py", line 202, in
app.run(main=main, argv=[sys.argv[0]] + unparsed)
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "tools/freeze_graph.py", line 135, in main
FLAGS.variable_names_blacklist)
File "tools/freeze_graph.py", line 94, in freeze_graph
text_format.Merge(f.read().decode("utf-8"), input_graph_def)
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 525, in Merge
descriptor_pool=descriptor_pool)
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 579, in MergeLines
return parser.MergeLines(lines, message)
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 612, in MergeLines
self._ParseOrMerge(lines, message)
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 627, in _ParseOrMerge
self._MergeField(tokenizer, message)
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 727, in _MergeField
merger(tokenizer, message, field)
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 815, in _MergeMessageField
self._MergeField(tokenizer, sub_message)
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 727, in _MergeField
merger(tokenizer, message, field)
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 815, in _MergeMessageField
self._MergeField(tokenizer, sub_message)
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 727, in _MergeField
merger(tokenizer, message, field)
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 815, in _MergeMessageField
self._MergeField(tokenizer, sub_message)
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 727, in _MergeField
merger(tokenizer, message, field)
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 815, in _MergeMessageField
self._MergeField(tokenizer, sub_message)
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 714, in _MergeField
tokenizer.Consume(':')
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 1078, in Consume
if not self.TryConsume(token):
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 1065, in TryConsume
self.NextToken()
File "/home/mrzhang/anaconda2/lib/python2.7/site-packages/google/protobuf/text_format.py", line 1314, in NextToken
match = self._TOKEN.match(self._current_line, self._column)
MemoryError

我看之前有人也是同样的问题,koth大大回复说加上模型导出了,我的代码是才check下来的,我修改了train_pos.py 文件里面的tf.app.flags.DEFINE_integer("max_sentence_len", 200,
"max num of tokens per query")
tf.app.flags.DEFINE_integer("embedding_word_size", 100, "embedding size")
tf.app.flags.DEFINE_integer("embedding_char_size", 100, "second embedding size") 长度增大了,是这个的问题吗?

koth commented

参考 #92