move slim into arch

pull/1540/head
weishengyu 2021-12-09 20:08:57 +08:00
parent 7c6567cc6b
commit ad1a2fd137
5 changed files with 3 additions and 6 deletions

View File

@ -26,7 +26,7 @@ from .utils import *
from ppcls.arch.backbone.base.theseus_layer import TheseusLayer
from ppcls.utils import logger
from ppcls.utils.save_load import load_dygraph_pretrain
from ppcls.engine.slim import prune_model, quantize_model
from ppcls.arch.slim import prune_model, quantize_model
__all__ = ["build_model", "RecModel", "DistillationModel"]

View File

@ -12,5 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from ppcls.engine.slim.prune import prune_model
from ppcls.engine.slim.quant import quantize_model
from ppcls.arch.slim.prune import prune_model

View File

@ -186,8 +186,6 @@ class Engine(object):
# build model
self.model = build_model(self.config)
self.quanted = self.config.get("Slim", {}).get("quant", False)
self.pruned = self.config.get("Slim", {}).get("prune", False)
# set @to_static for benchmark, skip this by default.
apply_to_static(self.config, self.model)
@ -368,7 +366,7 @@ class Engine(object):
model.eval()
save_path = os.path.join(self.config["Global"]["save_inference_dir"],
"inference")
if self.quanted:
if model.quanter:
model.quanter.save_quantized_model(
model.base_model,
save_path,