replace_tensors

onnx_safetensors.replace_tensors(model, /, location, base_dir)[source]

Replace all tensors in an ONNX model with external data from a safetensors file.

Added in version 1.0: Added the function.

Parameters:
  • model (Model) – ONNX model to replace tensors in.

  • location (str | PathLike) – Path to the safetensors file relative to the ONNX model file.

  • base_dir (str | PathLike) – Directory where the ONNX model file is stored.

Return type:

None