【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后,训练损失偏大的问题。

相关推荐
可乐鸡翅好好吃14 小时前
通过BUG(prvIdleTask、pxTasksWaitingTerminatio不断跳转问题)了解空闲函数(prvIdleTask)和TCB
c语言·stm32·单片机·嵌入式硬件·bug·keil
神膘护体小月半21 小时前
bug 记录 - 使用 el-dialog 的 before-close 的坑
前端·javascript·bug
顽强d石头1 天前
bug:undefined is not iterable (cannot read property Symbol(Symbol.iterator))
前端·bug
阿松のblog2 天前
opencv使用经典bug
人工智能·opencv·bug
学习啷个办2 天前
centos挂载目录满但实际未满引发系统宕机
bug
我们的五年4 天前
【Qt】Bug:findChildren找不到控件
开发语言·qt·bug
seiyaaa4 天前
Claude Opus solved my white whale bug today that I couldn‘t find in 4 years
bug
六天测试工程师4 天前
做好 4个基本动作,拦住性能优化改坏原功能的bug
服务器·性能优化·bug
良辰美景好时光4 天前
keepalived定制日志bug
linux·运维·bug
CYRUS STUDIO5 天前
FART 自动化脱壳框架一些 bug 修复记录
android·bug·逆向·fart·脱壳