load_file_as_external_data

onnx_safetensors.load_file_as_external_data(model, /, location, base_dir='')[source]

Load weights from safetensors file and use them as external data for the ONNX model.

Added in version 1.0: Added the function.

Parameters:
  • model (TModel) – ONNX model or graph to load external data into.

  • 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.

Returns:

The ONNX model with the external data.

Return type:

TModel