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
11.73k stars 2.86k forks source link

[Question]: 如下代码,为什么这里要硬编码entitie_label == 2呢,如果关联关系里面正好没有值为2的这个关系,就会报错, 例如有4个label:{'a':1,'b':2,'c':3,'d':4},训练数据里的关系只有[(1,3),(1,4)],走到这一步时就会产生一个空集合,再往下面走就会报Floating point exception #5985

Open happybuby opened 1 year ago

happybuby commented 1 year ago

请提出你的问题

如下代码,为什么这里要硬编码entitie_label == 2呢,如果关联关系里面正好没有值为2的这个关系,就会报错, 例如有4个label:{'a':1,'b':2,'c':3,'d':4},训练数据里的关系只有[(1,3),(1,4)],走到这一步时就会产生一个空集合,再往下面走就会报Floating point exception

代码位置如下: https://github.com/PaddlePaddle/PaddleNLP/blob/164896107fae422bb108eb48dc37dd0158aef88a/paddlenlp/transformers/layoutxlm/modeling.py#LL1163C57-L1163C57

all_possible_relations2 = all_possible_relations2[entitie_label == 2]

w5688414 commented 1 month ago

请问您的paddle和paddlenlp的环境是什么?