按照Github中的SDP教程,加载中文模型SEMEVAL16_ALL_ELECTRA_SMALL_ZH
时能正常运行,但是在处理英文文本时,加载SEMEVAL15_PAS_BIAFFINE_EN
等英文模型时运行会报错:
InvalidArgumentError: {{function_node __wrapped__IteratorGetNext_output_types_4_device_/job:localhost/replica:0/task:0/device:CPU:0}} ValueError: not enough values to unpack (expected 4, got 3)
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/tensorflow/python/ops/script_ops.py", line 271, in __call__
ret = func(*args)
File "/usr/local/lib/python3.9/dist-packages/tensorflow/python/autograph/impl/api.py", line 642, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 1039, in generator_py_func
values = next(generator_state.get_iterator(iterator_id))
File "/usr/local/lib/python3.9/dist-packages/hanlp/transform/conll_tf.py", line 149, in generator
corpus = list(x for x in (samples() if callable(samples) else samples))
File "/usr/local/lib/python3.9/dist-packages/hanlp/transform/conll_tf.py", line 149, in <genexpr>
corpus = list(x for x in (samples() if callable(samples) else samples))
File "/usr/local/lib/python3.9/dist-packages/hanlp/common/transform_tf.py", line 157, in generator
yield from samples
File "/usr/local/lib/python3.9/dist-packages/hanlp/transform/conll_tf.py", line 727, in inputs_to_samples
form, cpos, head, deprel = sample[0]
ValueError: not enough values to unpack (expected 4, got 3)
[[{{node PyFunc}}]] [Op:IteratorGetNext]
在colab中和本地环境中都会出现以上错误,所以请问在处理英文的SDP时应该如何使用?
本地运行环境:
- Python 3.8 / 3.9
- 除了执行
pip install -U hanlp[full]
之外没有安装其他包 - Windows和Linux均测试过