serialization
Serialization utilities for secure checkpoint saving and loading.
Functions
Load a checkpoint securely using |
|
Save a checkpoint after sanitizing known types for |
- safe_load(f, **kwargs)
Load a checkpoint securely using
weights_only=Trueby default.NOTE: We dont set default
weights_only(interpret as True for torch>=2.6) so you can override it withexport TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1if you seepickle.UnpicklingErrorand trust the checkpoint.- Parameters:
f (str | PathLike | BinaryIO | bytes)
- Return type:
Any
- safe_save(obj, f, **kwargs)
Save a checkpoint after sanitizing known types for
weights_only=Truecompatibility.- Parameters:
obj (Any)
f (str | PathLike | BinaryIO)
- Return type:
None