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

[Bug]: zero_shot_text_classification的compute_metrics方法错误 #9710

Open
1 task done
phpdancer opened this issue Dec 27, 2024 · 0 comments
Open
1 task done

[Bug]: zero_shot_text_classification的compute_metrics方法错误 #9710

phpdancer opened this issue Dec 27, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@phpdancer
Copy link

软件环境

- paddlepaddle:
- paddlepaddle-gpu: 2.4.2.post116
- paddlenlp: 2.5.2.post0

重复问题

  • I have searched the existing issues

错误描述

在文本分类任务中,使用zero_shot_text_classification和text_classification里的multi_label各训练一个多分类模型,发现两者的准确率相差巨大,通过代码发现zero_shot_text_classification里计算准确率的方法compute_metrics会把多分类的one-hot全部展开为一维,导致macro_f1值偏高很多,而multi_label里的准确率计算是正确的。

稳定复现步骤 & 代码

文件:applications/zero_shot_text_classification/run_eval.py
将如下代码:
preds = preds[labels != -100].numpy()
labels = labels[labels != -100].numpy()
改为:
preds = preds.numpy()
labels = labels.numpy()
即可正常

@phpdancer phpdancer added the bug Something isn't working label Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants