shiyybua / NER

基于tensorflow深度学习的中文的命名实体识别
1.04k stars 400 forks source link

预测时报错,求解 #63

Open Gemini77 opened 5 years ago

Gemini77 commented 5 years ago

runfile('D:/crf058/BNN+CRF/rnn.py', wdir='D:/crf058/BNN+CRF') building word index... source vocabulary file has already existed, continue to next stage. target vocabulary file has already existed, continue to next stage. Reloaded modules: utils, config building word index... source vocabulary file has already existed, continue to next stage. target vocabulary file has already existed, continue to next stage. loading word embedding, it will take few minutes... Traceback (most recent call last):

File "", line 1, in runfile('D:/crf058/BNN+CRF/rnn.py', wdir='D:/crf058/BNN+CRF')

File "D:\Python\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace)

File "D:\Python\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "D:/crf058/BNN+CRF/rnn.py", line 160, in iterator = get_predict_iterator(src_vocab_table, vocab_size, BATCH_SIZE)

File "D:\crf058\BNN+CRF\utils.py", line 230, in get_predict_iterator batched_iter = batched_dataset.make_initializable_iterator()

File "D:\Python\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 118, in make_initializable_iterator initializer = gen_dataset_ops.make_iterator(self._as_variant_tensor(),

File "D:\Python\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 2135, in _as_variant_tensor self._input_dataset._as_variant_tensor(), # pylint: disable=protected-access

File "D:\Python\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 2205, in _as_variant_tensor input_t = self._input_dataset._as_variant_tensor() # pylint: disable=protected-access

File "D:\Python\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 2210, in _as_variant_tensor **flat_structure(self))

File "D:\Python\lib\site-packages\tensorflow\python\ops\gen_dataset_ops.py", line 2759, in map_dataset output_shapes=output_shapes, name=name)

File "D:\Python\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 350, in _apply_op_helper g = ops._get_graph_from_inputs(_Flatten(keywords.values()))

File "D:\Python\lib\site-packages\tensorflow\python\framework\ops.py", line 5428, in _get_graph_from_inputs _assert_same_graph(original_graph_element, graph_element)

File "D:\Python\lib\site-packages\tensorflow\python\framework\ops.py", line 5364, in _assert_same_graph original_item))

ValueError: Tensor("string_to_index_8/hash_table:0", shape=(), dtype=resource) must be from the same graph as Tensor("MapDataset_1:0", shape=(), dtype=variant).