Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KIE: re train error #9184

Closed
hbo-lambda opened this issue Feb 22, 2023 · 15 comments
Closed

KIE: re train error #9184

hbo-lambda opened this issue Feb 22, 2023 · 15 comments
Assignees

Comments

@hbo-lambda
Copy link

SER模型训练时,尝试在class_list_xfun.txt中添加了4个label,如下

OTHER
QUESTION
ANSWER
HEADER
NAME_KEY
NAME_VAL
SEX_KEY
SEX_VAL

SER的模型已训练完毕。想训练RE模型时,沿用SER的class_list_xfun.txt标签,却出现如下报错

  File "/home/aistudio/PaddleOCR/ppocr/data/simple_dataset.py", line 137, in __getitem__
    outs = transform(data, self.ops)
  File "/home/aistudio/PaddleOCR/ppocr/data/imaug/__init__.py", line 57, in transform
    data = op(data)
  File "/home/aistudio/PaddleOCR/ppocr/data/imaug/vqa/token/vqa_token_chunk.py", line 109, in __call__
    item['entities']['label'] = [
  File "/home/aistudio/PaddleOCR/ppocr/data/imaug/vqa/token/vqa_token_chunk.py", line 110, in <listcomp>
    self.entities_labels[x] for x in item['entities']['label']
KeyError: 'NAME_KEY'

RE配置文件 configs/kie/vi_layoutxlm/re_vi_layoutxlm_xfund_zh.yml 中的class_path指定路径无误,配置文件还有其他地方涉及到label的地方吗

@tink2123
Copy link
Collaborator

看报错是这个位置:

可以修改配置文件:

      - VQAReTokenChunk:
          max_seq_len: *max_seq_len
          entities_labels: { 'HEADER': 0, 'QUESTION': 1, 'ANSWER': 2, 'NAME_KEY':3, 'SEX_KEY':4, 'SEX_VAL':5}

@hbo-lambda
Copy link
Author

ok,谢谢

@harshsummit
Copy link

After this, it will give float point exception error

@harshsummit
Copy link

Hey @hbo-lambda if you are able to successfully train this RE model, please let me know, I need help for the same

@hbo-lambda
Copy link
Author

Hey @hbo-lambda if you are able to successfully train this RE model, please let me know, I need help for the same
fail. !!!!!

@ariefwijaya
Copy link

any update on this?

@github-actions
Copy link
Contributor

github-actions bot commented Aug 8, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Aug 8, 2023
@bagaabu
Copy link

bagaabu commented Dec 8, 2023

same issue, any update? or anyone run the traing can help?

@c-avan
Copy link

c-avan commented Dec 12, 2023

我也出现这个问题了,配置文件添加entities_labels:{}后出现如下错误:
File "/usr/local/lib/python3.10/dist-packages/paddle/tensor/manipulation.py", line 1842, in stack
return _C_ops.stack(x, axis)
ValueError: (InvalidArgument) x dim number should greater than 0, but received value is: 0
[Hint: Expected x_dim > 0, but received x_dim:0 <= 0:0.] (at ../paddle/phi/backends/gpu/gpu_launch_config.h:175)

@github-actions github-actions bot removed the stale label Jan 3, 2024
@woguwo
Copy link

woguwo commented Jan 31, 2024

我也出现这个问题了,配置文件添加entities_labels:{}后出现如下错误: File "/usr/local/lib/python3.10/dist-packages/paddle/tensor/manipulation.py", line 1842, in stack return _C_ops.stack(x, axis) ValueError: (InvalidArgument) x dim number should greater than 0, but received value is: 0 [Hint: Expected x_dim > 0, but received x_dim:0 <= 0:0.] (at ../paddle/phi/backends/gpu/gpu_launch_config.h:175)

您好,我在训练kie的时候也出现一样问题了,您解决这个问题了吗?

@XiYuan68
Copy link

@c-avan @woguwo 看这里
#9184 (comment)

@UserWangZz
Copy link
Collaborator

It has not been updated for a long time. This issue is temporarily closed and can be reopened if necessary.

@freezehe
Copy link

@tink2123 这个bug修复了吗?我现在也遇到了这样的问题?是否有解决方案

@freezehe
Copy link

@tink2123 这个bug修复了吗?我现在也遇到了这样的问题?是否有解决方案

@XiYuan68 你好,这个bug修复了吗?

@chairc
Copy link

chairc commented Nov 6, 2024

我测了一下出一个一般的解决方案
1、KeyError参考 #9184 (comment) 修改entities_labels为自己的类别
2、可能会报[Hint: Expected x_dim > 0, but received x_dim:0 <= 0:0.]错误,参考#11261 (comment),这是因为数据集的label的顺序问题导致的,可以修改部分代码跳过报错问题解决
3、潜在版本问题会报AttributeError: 'bool' object has no attribute 'sum'错误,这是paddlenlp新版本修改了部分代码导致的,参考#13368 (comment)降低版本paddlepaddle==2.4.1 paddlenlp==2.5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests