首页 > 其他分享 >报错解决:UserWarning: Detected call of `lr_scheduler.step()` before `optimizer.step()`.

报错解决:UserWarning: Detected call of `lr_scheduler.step()` before `optimizer.step()`.

时间:2022-08-17 12:16:15浏览次数:75  
标签:optimizer call step 报错 scheduler lr before

训练HGNN报错:

 

 

 报错内容:

/root/miniconda3/lib/python3.8/site-packages/torch/optim/lr_scheduler.py:131: 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. See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate
warnings.warn("Detected call of `lr_scheduler.step()` before `optimizer.step()`. "

根据报错提示修改:

 

 

 参考pytorch遇到的坑(1) UserWarning: Detected call of `lr_scheduler.step()` before `optimizer.step()`. In PyT(you gotta go there to come back) - 开发者知识库 (itdaan.com)

标签:optimizer,call,step,报错,scheduler,lr,before
From: https://www.cnblogs.com/Catherinezhilin/p/16594640.html

相关文章