" unpack (expected 4, got 3)" from HanLP(['XXXXX']) 运行错误
1558359609 opened this issue · 1 comments
Describe the bug
在本地运行SDP语义依存分析模型时候出现了bug
Code to reproduce the issue
import hanlp
import torch
xx=hanlp.pretrained.sdp.SEMEVAL15_PSD_BIAFFINE_EN
HanLP = hanlp.load(xx,devices=torch.device('cpu'))
HanLP(['abc def ghk'])
Describe the current behavior
InvalidArgumentError Traceback (most recent call last)
d:\Projects\vscode\oj\oj1.ipynb Cell 3 line 6
4 xx=hanlp.pretrained.sdp.SEMEVAL15_PSD_BIAFFINE_EN
5 HanLP = hanlp.load(xx,devices=torch.device('cpu'))
Expected behavior
A clear and concise description of what you expected to happen.
----> 6 HanLP(['abc def ghk'])
File c:\Users\dongyuwu.conda\envs\hanlp\lib\site-packages\hanlp\common\component.py:36, in Component.call(self, *args, **kwargs)
25 def call(self, *args, **kwargs):
26 """
27 A shortcut for :func:~hanlp.common.component.predict
.
28
(...)
34
35 """
---> 36 return self.predict(*args, **kwargs)
File c:\Users\dongyuwu.conda\envs\hanlp\lib\site-packages\hanlp\common\keras_component.py:479, in KerasComponent.predict(self, data, batch_size, **kwargs)
477 data_is_list = isinstance(data, list)
478 print(dataset)
--> 479 for idx, batch in enumerate(dataset):
480 samples_in_batch = tf.shape(
481 batch[-1] if isinstance(batch[-1], tf.Tensor) else batch[-1][0])[0]
482 if data_is_list:
...
ValueError: not enough values to unpack (expected 4, got 3)
[[{{node PyFunc}}]] [Op:IteratorGetNext] name:
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
- Python version:3.8.18
- HanLP version: 2.1.0b51
Other info / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
- I've completed this form and searched the web for solutions.