Traceback (most recent call last):
File "dp_test.py", line 9, in <module>
parser.evaluate(CTB5_DEP_TEST, save_dir)
File "/home/glh/github/HanLP/hanlp/components/parsers/biaffine_parser.py", line 142, in evaluate
return super().evaluate(input_path, save_dir, output, batch_size, logger, callbacks, warm_up, verbose, **kwargs)
File "/home/glh/github/HanLP/hanlp/common/component.py", line 98, in evaluate
self.model.predict_on_batch(list(tst_data.take(1))[0])
File "/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py", line 1820, in predict_on_batch
outputs = self.predict_function(iterator)
File "/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 828, in __call__
result = self._call(*args, **kwds)
File "/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 871, in _call
self._initialize(args, kwds, add_initializers_to=initializers)
File "/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 725, in _initialize
self._stateful_fn._get_concrete_function_internal_garbage_collected( # pylint: disable=protected-access
File "/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 2969, in _get_concrete_function_internal_garbage_collected
graph_function, _ = self._maybe_define_function(args, kwargs)
File "/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 3361, in _maybe_define_function
graph_function = self._create_graph_function(args, kwargs)
File "/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 3196, in _create_graph_function
func_graph_module.func_graph_from_py_func(
File "/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 990, in func_graph_from_py_func
func_outputs = python_func(*func_args, **func_kwargs)
File "/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 634, in wrapped_fn
out = weak_wrapped_fn().__wrapped__(*args, **kwds)
File "/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 977, in wrapper
raise e.ag_error_metadata.to_exception(e)
AttributeError: in user code:
/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py:1478 predict_function *
return step_function(self, iterator)
/home/glh/github/HanLP/hanlp/components/parsers/biaffine/model.py:86 call *
word_embed += self.pretrained(words)
/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py:1012 __call__ **
outputs = call_fn(inputs, *args, **kwargs)
/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/keras/layers/embeddings.py:190 call **
dtype = K.dtype(inputs)
/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/util/dispatch.py:201 wrapper
return target(*args, **kwargs)
/home/glh/miniconda3/envs/tf2/lib/python3.8/site-packages/tensorflow/python/keras/backend.py:1418 dtype
return x.dtype.base_dtype.name
AttributeError: 'tuple' object has no attribute 'dtype'
无论是通过pip install hanlp还是通过github代码进行训练后,到了parser.evaluate(ctb_test, save_dir)就出出现上述报错,代码运行环境是anaconda环境(python3.6,python3.8, tensorflow2.3,tensorflow2.4)都会出现同样的报错。
请问这个是什么原因呢?