From fe8d103cf968073b63ffb2c98c8203180e0358c0 Mon Sep 17 00:00:00 2001 From: zhoujun Date: Fri, 24 Jun 2022 18:30:25 +0800 Subject: [PATCH] update save model (#6697) --- 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 b09f1db6e9..3647111fdd 100644 --- a/ppocr/utils/save_load.py +++ b/ppocr/utils/save_load.py @@ -177,9 +177,9 @@ def save_model(model, model.backbone.model.save_pretrained(model_prefix) metric_prefix = os.path.join(model_prefix, 'metric') # save metric and config + with open(metric_prefix + '.states', 'wb') as f: + pickle.dump(kwargs, f, protocol=2) if is_best: - with open(metric_prefix + '.states', 'wb') as f: - pickle.dump(kwargs, f, protocol=2) logger.info('save best model is to {}'.format(model_prefix)) else: logger.info("save model in {}".format(model_prefix))