From 0e20e60f6b1f65709dfdd9bc7bb8336c413713d7 Mon Sep 17 00:00:00 2001 From: dongshuilong Date: Mon, 18 Oct 2021 10:07:14 +0000 Subject: [PATCH] fix slim load pretrained model bug --- ppcls/engine/engine.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ppcls/engine/engine.py b/ppcls/engine/engine.py index d0f2d647..9ff807f7 100644 --- a/ppcls/engine/engine.py +++ b/ppcls/engine/engine.py @@ -183,6 +183,11 @@ class Engine(object): self.model = build_model(self.config["Arch"]) # set @to_static for benchmark, skip this by default. apply_to_static(self.config, self.model) + + # for slim + self.pruner = get_pruner(self.config, self.model) + self.quanter = get_quaner(self.config, self.model) + # load_pretrain if self.config["Global"]["pretrained_model"] is not None: if self.config["Global"]["pretrained_model"].startswith("http"): @@ -192,10 +197,6 @@ class Engine(object): load_dygraph_pretrain( self.model, self.config["Global"]["pretrained_model"]) - # for slim - self.pruner = get_pruner(self.config, self.model) - self.quanter = get_quaner(self.config, self.model) - # build optimizer if self.mode == 'train': self.optimizer, self.lr_sch = build_optimizer( -- GitLab