lr = paddle.optimizer.lr.PolynomialDecay(learning_rate=0.01, decay_steps=total_steps, end_lr=0.001)
# 使用Adam优化器
opt = paddle.optimizer.Adam(learning_rate=lr, parameters=model.parameters())
# 加载参数到优化器
opt.set_state_dict(opt_dict)
出现如下的错误
~\AppData\Roaming\Python\Python37\site-packages\paddle\optimizer\optimizer.py in _add_accumulator(self, name, param, dtype, fill_value, shape, type, device)
513 if len(self._accumulators_holder) > 0:
514 assert var_name in self._accumulators_holder, \
--> 515 "Optimizer set error, {} should in state dict".format( var_name )
516 var.set_value(self._accumulators_holder[var_name])
517
AssertionError: Optimizer set error, conv2d_112.w_0_moment1_0 should in state dict
收藏
点赞
0
个赞
请登录后评论
TOP
切换版块
请问一下解决了吗
坤哥来了~
存一下优化器参数再马上读取,可以检测代码是否有问题
可以看一下这位大佬的帖子
http://ai.baidu.com/forum/topic/show/976675