提交 f4e400fa 编写于 作者: H HydrogenSulfate

fix bug when load dict for optimizer in resume training

上级 afb473e2
......@@ -105,7 +105,7 @@ def init_model(config, net, optimizer=None, loss: paddle.nn.Layer=None):
net.set_state_dict(para_dict)
loss.set_state_dict(para_dict)
for i in range(len(optimizer)):
optimizer[i].set_state_dict(opti_dict)
optimizer[i].set_state_dict(opti_dict[i])
logger.info("Finish load checkpoints from {}".format(checkpoints))
return metric_dict
......@@ -117,7 +117,7 @@ def init_model(config, net, optimizer=None, loss: paddle.nn.Layer=None):
else: # common load
load_dygraph_pretrain(net, path=pretrained_model)
logger.info("Finish load pretrained model from {}".format(
pretrained_model))
pretrained_model))
def save_model(net,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册