We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 443e229 commit d2caff6Copy full SHA for d2caff6
src/lightning/pytorch/core/saving.py
@@ -86,9 +86,11 @@ def _load_from_checkpoint(
86
return _load_state(cls, checkpoint, **kwargs)
87
if issubclass(cls, pl.LightningModule):
88
storage = _load_state(cls, checkpoint, strict=strict, **kwargs)
89
- assert len(checkpoint["state_dict"]) > 0
+ state_dict = checkpoint["state_dict"]
90
+ if not state_dict:
91
+ raise ValueError(f"The state dict in {checkpoint_path!r} contains no parameters.")
92
+ map_location = list(state_dict.values())[0].device
93
assert isinstance(storage, pl.LightningModule)
- map_location = list(checkpoint["state_dict"].values())[0].device
94
return storage.to(map_location)
95
96
raise NotImplementedError(f"Unsupported {cls}")
0 commit comments