Skip to content
Snippets Groups Projects
Commit 9cb232cd authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Merge branch 'checkpoint-wrapper' into 'master'

breaking: checkpoint the inner estimator only

See merge request !82
parents 0bf5d75f 7de28ba7
Branches
Tags
1 merge request!82breaking: checkpoint the inner estimator only
Pipeline #58889 passed
......@@ -570,8 +570,10 @@ class CheckpointWrapper(BaseWrapper, TransformerMixin):
if is_estimator_stateless(self.estimator):
return self
with open(self.model_path, "rb") as f:
model = cloudpickle.load(f)
self.__dict__.update(model.__dict__)
estimator = cloudpickle.load(f)
# we don't do self.estimator = estimator, because self.estimator
# might be used elsewhere
self.estimator.__dict__.update(estimator.__dict__)
return self
def save_model(self):
......@@ -579,7 +581,7 @@ class CheckpointWrapper(BaseWrapper, TransformerMixin):
return self
os.makedirs(os.path.dirname(self.model_path), exist_ok=True)
with open(self.model_path, "wb") as f:
cloudpickle.dump(self, f)
cloudpickle.dump(self.estimator, f)
return self
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment