未验证 提交 f7111d7b 编写于 作者: L littletomatodonkey 提交者: GitHub

Merge pull request #467 from BeyondYourself/develop

add a necessary check for checkpoints
...@@ -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:
path = checkpoints if os.path.exists(checkpoints + '.pdparams'):
fluid.load(program, path, exe) path = checkpoints
logger.info("Finish initing model from {}".format(path)) fluid.load(program, path, exe)
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.
先完成此消息的编辑!
想要评论请 注册