mirror of
https://github.com/PaddlePaddle/PaddleOCR.git
synced 2025-06-03 21:53:39 +08:00
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
This commit is contained in:
parent
6280caac16
commit
e0f3bcb494
@ -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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user