FlagEmbedding icon indicating copy to clipboard operation
FlagEmbedding copied to clipboard

grad_norm特别大,这样训练正常吗

Open iamreallyi9 opened this issue 1 year ago • 1 comments

image 参数以下: --learning_rate 3e-5
--fp16
--num_train_epochs 2
--per_device_train_batch_size 4
--dataloader_drop_last True
--normlized False
--temperature 0.02
--query_max_len 512
--passage_max_len 512
--train_group_size 6
--use_inbatch_neg False
--negatives_cross_device False
--logging_steps 200
--save_steps 5350
--query_instruction_for_retrieval ""

1.6W的数据量,grad_norm很大是什么情况,还有就是loss scaler是做什么用的呢?为什么会出现梯度爆炸呢?感谢解答

iamreallyi9 avatar Sep 29 '24 01:09 iamreallyi9

感觉训崩了。28的loss太大了。请问是从哪个模型启动训练的。梯度爆炸一般需要调小学习率learning_rate,检查数据是否正常。 loss scaler用来放缩loss避免精度溢出。

staoxiao avatar Sep 30 '24 08:09 staoxiao