Skip to content

Commit 65cc1ed

Browse files
committed
add docs on weights_only arg
1 parent 074b01e commit 65cc1ed

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lightning/fabric/utilities/cloud_io.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ def _load(
4141
Args:
4242
path_or_url: Path or URL of the checkpoint.
4343
map_location: a function, ``torch.device``, string or a dict specifying how to remap storage locations.
44+
weights_only: If ``True``, restricts loading to ``state_dicts`` of plain ``torch.Tensor`` and other primitive
45+
types. If loading a checkpoint from a trusted source that contains an ``nn.Module``, use
46+
``weights_only=False``. If loading checkpoint from an untrusted source, we recommend using
47+
``weights_only=True``. For more information, please refer to the
48+
`PyTorch Developer Notes on Serialization Semantics <https://docs.pytorch.org/docs/main/notes/serialization.html#id3>`__.
4449
4550
"""
4651
if not isinstance(path_or_url, (str, Path)):

0 commit comments

Comments
 (0)