Skip to content
heliaEDGE
Reference
HELIA

readers

Read named tensors from source files: path -> {name: array}, one reader per SourceFormat.

The onnx reader needs the onnx extra and the torch reader the torch extra; both are imported only when called. The safetensors reader uses NumPy alone.

Machine-readable model

  • read_onnxfunctionThe initializers of a self-contained .onnx model, by name.
  • read_safetensorsfunctionThe tensors of a .safetensors file, by name (little-endian; BF16 is not supported).
  • read_torchfunctionThe tensors of a PyTorch state dict saved with torch.save, loaded with weightsonly=True.
  • readfunctionThe tensors of the file at path, read as format.
function

read_onnx

Python

The initializers of a self-contained .onnx model, by name.

helia_edge/importers/readers.py:29

read_onnx(path: Path) -> dict[str, npt.NDArray]

The initializers of a self-contained .onnx model, by name.

Weights held in Constant nodes rather than initializers are not read; such a source tensor is reported as not in the file.

Errors raised by read_onnx
TypeDescription
ValueErrorIf an initializer is stored in a separate data file, which the source's sha256 does not cover.
function

The tensors of a .safetensors file, by name (little-endian; BF16 is not supported).

helia_edge/importers/readers.py:54

read_safetensors(path: Path) -> dict[str, npt.NDArray]

The tensors of a .safetensors file, by name (little-endian; BF16 is not supported).

function

The tensors of a PyTorch state dict saved with torch.save, loaded with weightsonly=True.

helia_edge/importers/readers.py:71

read_torch(path: Path) -> dict[str, npt.NDArray]

The tensors of a PyTorch state dict saved with torch.save, loaded with weights_only=True.

function

read

Python

The tensors of the file at path, read as format.

helia_edge/importers/readers.py:89

read(format: SourceFormat, path: Path) -> dict[str, npt.NDArray]

The tensors of the file at path, read as format.