From 7f1badf74c258c116d6c6a439ea1ac162fcb97ae Mon Sep 17 00:00:00 2001 From: WenmuZhou <572459439@qq.com> Date: Wed, 24 Nov 2021 10:23:06 +0000 Subject: [PATCH] pair param with key when load trained model params --- ppocr/utils/save_load.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ppocr/utils/save_load.py b/ppocr/utils/save_load.py index 7bdaafd5..4b890f6f 100644 --- a/ppocr/utils/save_load.py +++ b/ppocr/utils/save_load.py @@ -54,7 +54,7 @@ def load_model(config, model, optimizer=None): pretrained_model = global_config.get('pretrained_model') best_model_dict = {} if checkpoints: - if checkpoints.endswith('pdparams'): + if checkpoints.endswith('.pdparams'): checkpoints = checkpoints.replace('.pdparams', '') assert os.path.exists(checkpoints + ".pdparams"), \ "The {}.pdparams does not exists!".format(checkpoints) @@ -97,7 +97,7 @@ def load_model(config, model, optimizer=None): def load_pretrained_params(model, path): logger = get_logger() - if path.endswith('pdparams'): + if path.endswith('.pdparams'): path = path.replace('.pdparams', '') assert os.path.exists(path + ".pdparams"), \ "The {}.pdparams does not exists!".format(path) -- GitLab