如何本地使用语义依存分析(SDP)的英文模型?

按照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均测试过

在加载模型时,使用use_pos=False执行,会报另一个错误。

sdp = hanlp.load('SEMEVAL15_DM_BIAFFINE_EN', use_pos=False)
graph = sdp(["where", "are", "you", "from", "?"])
print(graph)

报错信息:

UnknownError: {{function_node __wrapped__IteratorGetNext_output_types_4_device_/job:localhost/replica:0/task:0/device:CPU:0}} AssertionError: 
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 161, in generator
    yield from self.batched_inputs_to_batches(corpus, batch, shuffle)

  File "/usr/local/lib/python3.9/dist-packages/hanlp/transform/conll_tf.py", line 768, in batched_inputs_to_batches
    assert len(batch) == 4

AssertionError


	 [[{{node PyFunc}}]] [Op:IteratorGetNext]

看到了英文文档,明白其中的用法了,英文模型需要结合POS结果一起输入。