更新学习率时,分母为0.0,即group[‘t_total’]=0.0
# 报错
BERT/optimization.py", line 169, in step
lr_scheduled = group['lr'] * schedule_fct(state['step']/(group['t_total']), group['warmup'])
ZeroDivisionError: float division by zero
解决方案:加入float(“1e-8”)
lr_scheduled = group['lr'] * schedule_fct(state['step']/(group['t_total']+float("1e-8")), group['warmup'])
附:AI工具箱
链接:/docx/Mv4Dd8TEYoUmTAxfpLtcUoOKnZc?from=from_copylink