( filename: Union ) → Dict[str, np.ndarray]
Loads a safetensors file into numpy format.
( data: bytes ) → Dict[str, np.ndarray]
Loads a safetensors file into numpy format from pure bytes.
( tensor_dict: Dict filename: Union metadata: Optional = None ) → None
Parameters
Dict[str, np.ndarray]
) —
The incoming tensors. Tensors need to be contiguous and dense. str
, or os.PathLike
)) —
The filename we’re saving into. Dict[str, str]
, optional, defaults to None
) —
Optional text only metadata you might want to save in your header.
For instance it can be useful to specify more about the underlying
tensors. This is purely informative and does not affect tensor loading. Returns
None
Saves a dictionary of tensors into raw bytes in safetensors format.
( tensor_dict: Dict metadata: Optional = None ) → bytes
Parameters
Dict[str, np.ndarray]
) —
The incoming tensors. Tensors need to be contiguous and dense. Dict[str, str]
, optional, defaults to None
) —
Optional text only metadata you might want to save in your header.
For instance it can be useful to specify more about the underlying
tensors. This is purely informative and does not affect tensor loading. Returns
bytes
The raw bytes representing the format
Saves a dictionary of tensors into raw bytes in safetensors format.