From 4d775dc98f0448efd1b39c9f499b1cf64e1300b3 Mon Sep 17 00:00:00 2001 From: WenmuZhou Date: Mon, 9 Nov 2020 18:20:03 +0800 Subject: [PATCH] =?UTF-8?q?rc=E7=89=88=E6=9C=AC=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ppocr/utils/save_load.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ppocr/utils/save_load.py b/ppocr/utils/save_load.py index e74d8faa..004322c8 100644 --- a/ppocr/utils/save_load.py +++ b/ppocr/utils/save_load.py @@ -68,11 +68,11 @@ def load_dygraph_pretrain(model, logger, path=None, load_static_weights=False): param_state_dict[key] = pre_state_dict[weight_name] else: param_state_dict[key] = model_dict[key] - model.set_dict(param_state_dict) + model.set_state_dict(param_state_dict) return - param_state_dict, optim_state_dict = paddle.load(path) - model.set_dict(param_state_dict) + param_state_dict = paddle.load(path + '.pdparams') + model.set_state_dict(param_state_dict) return @@ -91,7 +91,7 @@ def init_model(config, model, logger, optimizer=None, lr_scheduler=None): "Given dir {}.pdopt not exist.".format(checkpoints) para_dict = paddle.load(checkpoints + '.pdparams') opti_dict = paddle.load(checkpoints + '.pdopt') - model.set_dict(para_dict) + model.set_state_dict(para_dict) if optimizer is not None: optimizer.set_state_dict(opti_dict) -- GitLab