PaddlePaddle / PaddleNLP

👑 Easy-to-use and powerful NLP and LLM library with 🤗 Awesome model zoo, supporting wide-range of NLP tasks from research to industrial applications, including 🗂Text Classification, 🔍 Neural Search, ❓ Question Answering, ℹ️ Information Extraction, 📄 Document Intelligence, 💌 Sentiment Analysis etc.
https://paddlenlp.readthedocs.io
Apache License 2.0
12.14k stars 2.94k forks source link

[Bug]: /home/ubuntu/miniconda3/envs/paddle/lib/python3.10/site-packages/paddlenlp/transformers/layoutxlm/modeling.py", line 1189, in build_relation if negative_mask.sum() > 0: AttributeError: 'bool' object has no attribute 'sum' #8914

Closed kezidanbao closed 3 weeks ago

kezidanbao commented 3 months ago

软件环境

- paddlepaddle:
- paddlepaddle-gpu: 2.6.1
- paddlenlp: 3.0.0b0.post20240810

重复问题

错误描述

Traceback (most recent call last):
  File "/data/llm/models/PaddleOCR/tools/eval.py", line 169, in <module>
    main()
  File "/data/llm/models/PaddleOCR/tools/eval.py", line 151, in main
    metric = program.eval(
  File "/data/llm/models/PaddleOCR/tools/program.py", line 624, in eval
    preds = model(batch)
  File "/home/ubuntu/miniconda3/envs/paddle/lib/python3.10/site-packages/paddle/nn/layer/layers.py", line 1429, in __call__
    return self.forward(*inputs, **kwargs)
  File "/data/llm/models/PaddleOCR/ppocr/modeling/architectures/base_model.py", line 85, in forward
    x = self.backbone(x)
  File "/home/ubuntu/miniconda3/envs/paddle/lib/python3.10/site-packages/paddle/nn/layer/layers.py", line 1429, in __call__
    return self.forward(*inputs, **kwargs)
  File "/data/llm/models/PaddleOCR/ppocr/modeling/backbones/vqa_layoutlm.py", line 248, in forward
    x = self.model(
  File "/home/ubuntu/miniconda3/envs/paddle/lib/python3.10/site-packages/paddle/nn/layer/layers.py", line 1429, in __call__
    return self.forward(*inputs, **kwargs)
  File "/home/ubuntu/miniconda3/envs/paddle/lib/python3.10/site-packages/paddlenlp/transformers/layoutxlm/modeling.py", line 1329, in forward
    loss, pred_relations = self.extractor(sequence_output, entities, relations)
  File "/home/ubuntu/miniconda3/envs/paddle/lib/python3.10/site-packages/paddle/nn/layer/layers.py", line 1429, in __call__
    return self.forward(*inputs, **kwargs)
  File "/home/ubuntu/miniconda3/envs/paddle/lib/python3.10/site-packages/paddlenlp/transformers/layoutxlm/modeling.py", line 1223, in forward
    relations, entities = self.build_relation(relations, entities)
  File "/home/ubuntu/miniconda3/envs/paddle/lib/python3.10/site-packages/paddlenlp/transformers/layoutxlm/modeling.py", line 1189, in build_relation
    if negative_mask.sum() > 0:
AttributeError: 'bool' object has no attribute 'sum'

稳定复现步骤 & 代码

python3 tools/eval.py -c configs/kie/vi_layoutxlm/re_vi_layoutxlm_xfund_zh.yml -o Architecture.Backbone.checkpoints=pretrain/re_vi_layoutxlm_xfund_pretrained/best_accuracy

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。

github-actions[bot] commented 3 weeks ago

This issue was closed because it has been inactive for 14 days since being marked as stale. 当前issue 被标记为stale已有14天,即将关闭。