未验证 提交 7fd8d6a2 编写于 作者: D Double_V 提交者: GitHub

Merge pull request #2878 from YukSing12/patch-1

Update save_load.py
...@@ -80,9 +80,9 @@ def init_model(config, model, logger, optimizer=None, lr_scheduler=None): ...@@ -80,9 +80,9 @@ def init_model(config, model, logger, optimizer=None, lr_scheduler=None):
""" """
load model from checkpoint or pretrained_model load model from checkpoint or pretrained_model
""" """
gloabl_config = config['Global'] global_config = config['Global']
checkpoints = gloabl_config.get('checkpoints') checkpoints = global_config.get('checkpoints')
pretrained_model = gloabl_config.get('pretrained_model') pretrained_model = global_config.get('pretrained_model')
best_model_dict = {} best_model_dict = {}
if checkpoints: if checkpoints:
assert os.path.exists(checkpoints + ".pdparams"), \ assert os.path.exists(checkpoints + ".pdparams"), \
...@@ -105,7 +105,7 @@ def init_model(config, model, logger, optimizer=None, lr_scheduler=None): ...@@ -105,7 +105,7 @@ def init_model(config, model, logger, optimizer=None, lr_scheduler=None):
logger.info("resume from {}".format(checkpoints)) logger.info("resume from {}".format(checkpoints))
elif pretrained_model: elif pretrained_model:
load_static_weights = gloabl_config.get('load_static_weights', False) load_static_weights = global_config.get('load_static_weights', False)
if not isinstance(pretrained_model, list): if not isinstance(pretrained_model, list):
pretrained_model = [pretrained_model] pretrained_model = [pretrained_model]
if not isinstance(load_static_weights, list): if not isinstance(load_static_weights, list):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册