在加载预训练模型继续训练时,程序报错:KeyError: “param ‘initial_lr’ is not specified in param_groups[0] when resuming an optimizer”
解决办法: lr_scheduler = torch.optim.lr_scheduler.MultiStepLR( optimizer, cfg.TRAIN.LR_STEP, cfg.TRAIN.LR_FACTOR, last_epoch=-1 )
对代码中出现的 last_epoch 或者end_epoch设置为-1即可,亲测管用。
参考:https://discuss.pytorch.org/t/a-problem-occured-when-resuming-an-optimizer/28822
04-10
8605
05-10
6325
11-18
655
07-17
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交