未验证 提交 e0f3bcb4 编写于 作者: S shaohua.zhang 提交者: GitHub

add a necessary check for checkpoints

add a necessary check for checkpoints, if you miss the file prefix and it will not execute the checkpoints codes
上级 6280caac
...@@ -109,9 +109,14 @@ def init_model(config, program, exe): ...@@ -109,9 +109,14 @@ def init_model(config, program, exe):
""" """
checkpoints = config['Global'].get('checkpoints') checkpoints = config['Global'].get('checkpoints')
if checkpoints: if checkpoints:
if os.path.exists(checkpoints + '.pdparams'):
path = checkpoints path = checkpoints
fluid.load(program, path, exe) fluid.load(program, path, exe)
logger.info("Finish initing model from {}".format(path)) logger.info("Finish initing model from {}".format(path))
else:
raise ValueError(
"Model checkpoints {} does not exists,"
"check if you lost the file prefix .".format(checkpoints + '.pdparams'))
pretrain_weights = config['Global'].get('pretrain_weights') pretrain_weights = config['Global'].get('pretrain_weights')
if pretrain_weights: if pretrain_weights:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册