Traceback (most recent call last):
File "/usr/local/anaconda3/envs/tf15/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/local/anaconda3/envs/tf15/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/tech/tony/ccks_triple_extract-master/albert_zh/extract_feature.py", line 92, in predict_from_queue
for i in prediction:
File "/usr/local/anaconda3/envs/tf15/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 619, in predict
features, None, ModeKeys.PREDICT, self.config)
File "/usr/local/anaconda3/envs/tf15/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1146, in _call_model_fn
model_fn_results = self._model_fn(features=features, **kwargs)
File "/tech/tony/ccks_triple_extract-master/albert_zh/extract_feature.py", line 75, in model_fn
return_elements=['final_encodes:0'])
File "/usr/local/anaconda3/envs/tf15/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/usr/local/anaconda3/envs/tf15/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 431, in import_graph_def
raise ValueError(str(e))
ValueError: Requested return tensor 'final_encodes:0' not found in graph def
在使用Albert的时候报了这么一个错,结果发现自己循环多次定义了BertVector。
看到github上bert-util2的Issue中的
https://github.com/terrifyzhao/bert-utils/issues/1
这里指出,不要在循环中使用或多次调用BertVector(),检查自己的代码,保证BertVector()只被声明一次,而bert.encode(contents)可以被多次使用,问题解决。