From 1c2aae567a8863c9cdb666fc3b553b8f01281d15 Mon Sep 17 00:00:00 2001 From: whs Date: Tue, 3 Sep 2019 20:03:21 +0800 Subject: [PATCH] Skip start epoch and end epoch when dumping strategy in PaddleSlim (#19580) test=develop --- python/paddle/fluid/contrib/slim/core/config.py | 2 +- python/paddle/fluid/contrib/slim/core/strategy.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/python/paddle/fluid/contrib/slim/core/config.py b/python/paddle/fluid/contrib/slim/core/config.py index 9b08a0324a5..cbe1c736fe8 100644 --- a/python/paddle/fluid/contrib/slim/core/config.py +++ b/python/paddle/fluid/contrib/slim/core/config.py @@ -27,7 +27,7 @@ __all__ = ['ConfigFactory'] """This factory is used to create instances by loading and parsing configure file with yaml format. """ -PLUGINS = ['pruners', 'quantizers', 'quantizers', 'strategies', 'controllers'] +PLUGINS = ['pruners', 'quantizers', 'distillers', 'strategies', 'controllers'] class ConfigFactory(object): diff --git a/python/paddle/fluid/contrib/slim/core/strategy.py b/python/paddle/fluid/contrib/slim/core/strategy.py index f2cd2a2835b..c0ddb758f39 100644 --- a/python/paddle/fluid/contrib/slim/core/strategy.py +++ b/python/paddle/fluid/contrib/slim/core/strategy.py @@ -29,6 +29,13 @@ class Strategy(object): self.start_epoch = start_epoch self.end_epoch = end_epoch + def __getstate__(self): + d = {} + for key in self.__dict__: + if key not in ["start_epoch", "end_epoch"]: + d[key] = self.__dict__[key] + return d + def on_compression_begin(self, context): pass -- GitLab