xnn.gnn.models.aimnet2_foundation.read_safetensors#

xnn.gnn.models.aimnet2_foundation.read_safetensors(path)[source]#

Read a .safetensors file into a dict of CPU tensors.

The format is a little-endian 8-byte header length, a JSON header mapping tensor names to dtype, shape and byte offsets, and the raw buffers; no package beyond torch is needed to read it.

Parameters:

path (str or Path) – The file.

Returns:

The tensors, in their stored dtypes.

Return type:

dict of str to torch.Tensor