Skip to content

Commit

Permalink
Fix model_
Browse files Browse the repository at this point in the history
  • Loading branch information
borchero committed May 23, 2022
1 parent dcc3cde commit 725cde3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lightkit/estimator/configurable.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ class ConfigurableBaseEstimator(BaseEstimator, Generic[M]):
:class:`lightkit.nn.Configurable` mixin.
"""

_model: M
model_: M

def save_attributes(self, path: Path) -> None:
# First, store simple attributes
super().save_attributes(path)

# Then, store the model
self._model.save(path / "model")
self.model_.save(path / "model")

def load_attributes(self, path: Path) -> None:
# First, load simple attributes
super().load_attributes(path)

# Then, load the model
model_cls = get_generic_type(self.__class__, ConfigurableBaseEstimator)
self._model = model_cls.load(path / "model") # type: ignore
self.model_ = model_cls.load(path / "model") # type: ignore

def __getattr__(self, key: str) -> Any:
try:
Expand Down

0 comments on commit 725cde3

Please sign in to comment.