更新学习率时,分母为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工具箱
链接:https://hxmbzkv9u5i.feishu.cn/docx/Mv4Dd8TEYoUmTAxfpLtcUoOKnZc?from=from_copylink

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐