【bug】使用transformers训练二分类任务时,训练损失异常大

使用transformers训练二分类任务时,训练损失异常大

问题

training_loss异常大,在二分类损失中,收敛在1~2附近,而eval_loss却正常(小于0.5)

分析

参考:
Bug in gradient accumulation training_step in huggingface Trainer?
Fix Gradient Accumulation issue
使用解决了多卡gradient accumulation严重BUG的最新transformer库(以及对应的trl库),DPO训练的时候LOSS变为之前的好几倍
New GA fix causes training loss multiple times higher across the board (5x to 10x higher)

版本:trainsformer==4.46.0

怀疑启用training_args.gradient_accumulation_steps后,training_loss变大。

对比后发现,确实启用GA后,training_loss会变大,差不多是不启用GA的4倍。

这下差不多可以确定,在启用GA后,training_loss乘上了GA。

看到社区也有很多人在讨论这个问题,目前transformers最新版本是4.46.3,不知道是否解决了这个问题。

最新版本是4.46.3,不知道是否解决了这个问题。

transformers怎么这么多bug...


20241122:实测4.46.3版本还是未解决使用GA后,训练损失偏大的问题。

相关推荐
自学也学好编程1 天前
【BUG】nvm无法安装低版本Node.js:The system cannot find the file specified解决方案
node.js·bug
WBingJ3 天前
记录一次薛定谔bug
python·opencv·bug
普宁彭于晏4 天前
uni-app switch(开关选择器) BUG
uni-app·bug
!chen6 天前
Oracle 19.20未知BUG导致oraagent进程内存泄漏
数据库·oracle·bug
SAP龙哥8 天前
SAP在未启用负库存的情况下,库存却出现了负数-补充S4 1709 BUG
运维·bug
lxmyzzs9 天前
【已解决】YOLO11模型转wts时报错:PytorchStreamReader failed reading zip archive
人工智能·python·深度学习·神经网络·目标检测·计算机视觉·bug
JHCan3339 天前
一个没有手动加分号引发的bug
前端·javascript·bug
lxmyzzs9 天前
【已解决】Jetson Orin NX apt更换国内源
嵌入式硬件·计算机视觉·bug
JAVA学习通9 天前
【测试开发】---Bug篇
bug
兰琛9 天前
android 小bug :文件冲突的问题
android·学习·bug