Skip to content

Commit

Permalink
Fix from last update...
Browse files Browse the repository at this point in the history
  • Loading branch information
JadenFiotto-Kaufman committed May 28, 2024
1 parent 6dc0af5 commit 416a6f2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/nnsight/models/NNsightModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ def __init__(
if dispatch and not self._dispatched:
# Dispatch ._model on initialization vs lazy dispatching.
self.dispatch_model()

self._initialized = True


logger.info(f"Initialized `{self._model_key}`")

def trace(
Expand Down Expand Up @@ -300,7 +298,7 @@ def __repr__(self) -> str:
def __setattr__(self, key: Any, value: Any) -> None:
"""Overload setattr to create and set an Envoy when trying to set a torch Module."""

if '_initialized' in self.__dict__ and isinstance(value, torch.nn.Module):
if key not in ('_model', '_model_key') and isinstance(value, torch.nn.Module):

setattr(self._envoy, key, value)

Expand Down

0 comments on commit 416a6f2

Please sign in to comment.