Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update load_state_dict() signature to align with torchsnapshot #887

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions torchdata/dataloader2/dataloader2.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def from_state(
data_loader.reading_service_state = reading_service_state
return data_loader

def load_state_dict(self, state: Dict[str, Any]) -> None:
def load_state_dict(self, state_dict: Dict[str, Any]) -> None:
"""
For the existing ``DataLoader2``, load serialized state to restore ``DataPipe`` graph
and reset the internal state of ``ReadingService``.
Expand All @@ -269,8 +269,8 @@ def load_state_dict(self, state: Dict[str, Any]) -> None:
"Please create a new dataloader in order to use load state dict."
)

serialized_datapipe = state[SERIALIZED_DATAPIPE_KEY_NAME]
reading_service_state = state[READING_SERVICE_STATE_KEY_NAME]
serialized_datapipe = state_dict[SERIALIZED_DATAPIPE_KEY_NAME]
reading_service_state = state_dict[READING_SERVICE_STATE_KEY_NAME]

# deserialize datapipe
deserialized_datapipe = deserialize_datapipe(serialized_datapipe)
Expand Down