Skip to main content

ONNX Models

ONNX (Open Neural Network Exchange) models provide cross-platform compatibility, allowing you to deploy models trained in various frameworks. However, ONNX models have limited SDK support in Chariot and require manual preprocessing and postprocessing. Under the hood, Chariot serves ONNX models using the Triton Server

Limitations

warning

Limited Chariot SDK Support: The Chariot SDK does not currently support making predictions for ONNX models. Applications must manage preprocessing and postprocessing steps and call the inference API directly.

File Format Requirements

ONNX models must be in .onnx format and can be provided as:

  • .onnx file: Direct ONNX model file
  • Archive: .tar.gz or directory containing the .onnx file

Import Example

When importing an ONNX model into Chariot, the model must be in the .onnx format.

import chariot.client
from chariot.models import import_model, ArtifactType, TaskType

# This is a path to the `.onnx` file or to a directory or tar file containing the `.onnx` file.
model_path = "path/to/model.onnx"
# Define mapping of class labels to integer output.
class_labels = {"dog": 0}

chariot.client.connect()
# This will create a new model entry in the catalog, at the project and name specified.
model = import_model(
name="<NAME OF MODEL>",
# One of `project_id` or `project_name` is required.
project_id="<PROJECT ID>",
project_name="<PROJECT NAME>",
version="<MODEL VERSION>",
summary="testing onnx model import",
task_type=TaskType.OBJECT_DETECTION,
artifact_type=ArtifactType.ONNX,
model_path=model_path,
class_labels=class_labels,
)