save

onnx_safetensors.save(model, /, *, size_threshold=0)[source]

Save all tensors in an ONNX model to a safetensors object serialized as bytes.

Parameters:
  • model (TModel) – ONNX model to save.

  • size_threshold (int) – Minimum size in bytes for a tensor to be saved. Default is 0, which saves all initializers.

Returns:

The safetensors object serialized as bytes.

Return type:

bytes