Trainer中
首先:
WarmupDecayLR
= --lr_scheduler_type linear
WarmupLR
= --lr_scheduler_type constant_with_warmup
1
TrainArgument不傳lr_scheduler_type、optim,warmup_steps=15
ds config文件中定義如下:
注意:如果不在TrainArgument傳入warmup_steps,直接在ds config指定的話會報錯,故需要結合使用。
學習率如下:
2
TrainArgument不傳lr_scheduler_type、optim,warmup_steps=15
ds config文件中定義如下:
學習率如下:
3
TrainArgument不傳optim,warmup_steps=15
lr_scheduler_type=constant_with_warmup
ds config文件中定義如下:
學習率如下:
可以得出:deepspeed中的優化器和學習率策略確實是有優先級的,兩個都定義的情況下會用deepspeed中的。
推薦用法:optim用deepspeed, lr_scheduler用huggingface的 cosine
cosine學習率圖如下:
PPOTrainer、RLOOTrainer
trl中的相關trainer是不支持deepspeed配置optimizer 和 lr_scheduler的,需要使用huggingface提供的。