serialization

Serialization utilities for secure checkpoint saving and loading.

Functions

safe_load

Load a checkpoint securely using weights_only=True by default.

safe_save

Save a checkpoint after sanitizing known types for weights_only=True compatibility.

safe_load(f, **kwargs)

Load a checkpoint securely using weights_only=True by default.

Parameters:

f (str | PathLike | BinaryIO | bytes)

Return type:

Any

safe_save(obj, f, **kwargs)

Save a checkpoint after sanitizing known types for weights_only=True compatibility.

Parameters:
  • obj (Any)

  • f (str | PathLike | BinaryIO)

Return type:

None