(
filename: str
)
→
Dict[str, tf.Tensor]
Parameters
str
, or os.PathLike
)) —
The name of the file which contains the tensors
Dict[str, any]
, optional, defaults to cpu
) —
The device where the tensors need to be located after load.
available options are all regular tensorflow device locations
Returns
Dict[str, tf.Tensor]
dictionary that contains name as key, value as tf.Tensor
Loads a safetensors file into tensorflow format.
(
data: bytes
)
→
Dict[str, tf.Tensor]
Loads a safetensors file into tensorflow format from pure bytes.
(
tensors: typing.Dict[str, tensorflow.python.framework.ops.Tensor]
filename: str
metadata: typing.Union[typing.Dict[str, str], NoneType] = None
)
→
None
Parameters
Dict[str, tf.Tensor]
) —
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 dictionnary of tensors into raw bytes in safetensors format.
(
tensors: typing.Dict[str, tensorflow.python.framework.ops.Tensor]
metadata: typing.Union[typing.Dict[str, str], NoneType] = None
)
→
bytes
Parameters
Dict[str, tf.Tensor]
) —
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 dictionnary of tensors into raw bytes in safetensors format.