From 3a2d0f61eedefad20dac0115a63c52a7c4398bf6 Mon Sep 17 00:00:00 2001 From: bingooo Date: Thu, 1 Jul 2021 15:26:55 +0800 Subject: [PATCH 1/2] fix bug --- ppocr/utils/save_load.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppocr/utils/save_load.py b/ppocr/utils/save_load.py index 76420abb..b762c0bb 100644 --- a/ppocr/utils/save_load.py +++ b/ppocr/utils/save_load.py @@ -98,7 +98,7 @@ def load_dygraph_params(config, model, logger, optimizer): pm = config['Global']['pretrained_model'] if pm is None: return {} - if not os.path.exists(pm) or not os.path.exists(pm + ".pdparams"): + if not os.path.exists(pm) and not os.path.exists(pm + ".pdparams"): logger.info(f"The pretrained_model {pm} does not exists!") return {} pm = pm if pm.endswith('.pdparams') else pm + '.pdparams' From 61cee7e6630668b113062ad6f7277ca089f987bb Mon Sep 17 00:00:00 2001 From: bingooo Date: Thu, 1 Jul 2021 15:41:02 +0800 Subject: [PATCH 2/2] fix bug --- ppocr/utils/save_load.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppocr/utils/save_load.py b/ppocr/utils/save_load.py index b762c0bb..1d760e98 100644 --- a/ppocr/utils/save_load.py +++ b/ppocr/utils/save_load.py @@ -91,7 +91,7 @@ def init_model(config, model, optimizer=None, lr_scheduler=None): def load_dygraph_params(config, model, logger, optimizer): ckp = config['Global']['checkpoints'] - if ckp and os.path.exists(ckp): + if ckp and os.path.exists(ckp + ".pdparams"): pre_best_model_dict = init_model(config, model, optimizer) return pre_best_model_dict else: