UserWarning: Detected call of `lr scheduler.step()` before `optimizer.step()`.

一、完成的错误信息

UserWarning: Detected call of lr scheduler.step() before optimizer.step(). In PyTorch 1.1.0 and later, you should call them in the opposite order: optimizer.step() before lr scheduler.step(). Failure to do this will result in PyTorch skipping the first value of the learning rate schedule.

在' optimizer.step() '之前检测到' lr scheduler.step() '的调用。在PyTorch 1.1.0及以后版本中,你应该以相反的顺序调用它们:' optimizer.step() '在' lr scheduler.step() '之前。如果做不到这一点,将导致PyTorch跳过学习速率计划的第一个值。

二、处理方式

  • 调节scheduler.step()的位置,将其放入整个epoch的最后
  • 一般是在训练集这个文件里,train_me.py

image

posted @   Trouvaille_fighting  阅读(4721)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示

目录导航