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

训练过程中有一定概率因为label全为0而报错 #266

Open
BarryRun opened this issue Dec 13, 2022 · 1 comment
Open

训练过程中有一定概率因为label全为0而报错 #266

BarryRun opened this issue Dec 13, 2022 · 1 comment

Comments

@BarryRun
Copy link

Describe the bug(问题描述)
根据这里 的代码,在verbose>0时,需要计算当前batch上的metric。而在特殊情况下,例如最后一个batch刚好只有几条label为0的数据时,会出现以下报错:

ValueError: y_true contains only one label (0.0). Please provide the true labels explicitly through the labels argument.

是否可以在trainer中添加让dataloader分布均匀的代码?

@11101028
Copy link

11101028 commented Aug 2, 2023

可以在basemodel.py的第268行加try,如果lable全为0就跳过

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

No branches or pull requests

2 participants