在训练resnet时raise ValueError("optimizer got an empty parameter list")
liurongfang opened this issue · 4 comments
liurongfang commented
您好,廖老师,感谢你写的书,我在运行你的github代码ch4-CNN.resnet的代码时出现上述错误,这个问题怎么解决呢,感谢
liurongfang commented
我找到了这个链接raise ValueError("optimizer got an empty parameter list"),但是修改为optimizer = optim.SGD(list(model.parameters()), lr=learning_rate)依旧报错
L1aoXingyu commented
hi,
是这里的代码吗
https://github.com/L1aoXingyu/code-of-learn-deep-learning-with-pytorch/blob/master/chapter4_CNN/resnet.ipynb <https://github.com/L1aoXingyu/code-of-learn-deep-learning-with-pytorch/blob/master/chapter4_CNN/resnet.ipynb>
best,
xingyu
… On Jun 14, 2018, at 11:21, liurf ***@***.***> wrote:
您好,廖老师,感谢你写的书,我在运行你的github代码ch4-CNN.resnet的代码时出现上述错误,这个问题怎么解决呢,感谢
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#14>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ASWpwAKwEh9f4CXiLCA5zjNm6GaZ-XT-ks5t8dangaJpZM4UnQFK>.
liurongfang commented
@L1aoXingyu 是的,是这里的代码,我是放在py文件中python本地运行的,win10 64bits,python3.6
L1aoXingyu commented
我运行是没有这个错的,要不你再试试,这个错误表示的是优化器里面没有得到参数列表,你先确定你定义好了model,然后调用model.parameters() 是可以得到model要训练的参数