提交 3f117428 编写于 作者: H HydrogenSulfate

fix code

上级 3a1276d3
......@@ -61,7 +61,7 @@ def build_optimizer(config, epochs, step_each_epoch, model_list=None):
for optim_item in optim_config:
# optim_cfg = {optim_name1: {scope: xxx, **optim_cfg}}
# step1 build lr
optim_name = optim_item.keys()[0] # get optim_name1
optim_name = list(optim_item.keys())[0] # get optim_name1
optim_scope = optim_item[optim_name].pop('scope') # get scope
optim_cfg = optim_item[optim_name] # get optim_cfg
......
......@@ -103,7 +103,7 @@ def init_model(config, net, optimizer=None, loss: paddle.nn.Layer=None):
metric_dict = paddle.load(checkpoints + ".pdstates")
# set state dict
net.set_state_dict(para_dict)
loss.loss_func[i].set_state_dict(para_dict)
loss.set_state_dict(para_dict)
for i in range(len(optimizer)):
optimizer[i].set_state_dict(opti_dict)
logger.info("Finish load checkpoints from {}".format(checkpoints))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册