OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Infrastructure & Serving

Tract

Tract is a self-contained neural-network inference library with a Rust public API for loading, optimising and running supported models.

Independent OpenViST project profile, based on linked sources.

Tract — OpenViST project profile in AI Infrastructure & Serving.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use Tract when an application needs to run supported neural-network models locally and you want an inference library rather than a hosted serving endpoint.

Who it is for

  • Rust developers integrating model inference into applications.
  • Teams building local or embedded inference workflows.
  • Developers exploring Python access to the same inference pipeline.

Documented uses

  • Load and run ONNX or NNEF models from a Rust application.
  • Run supported legacy TensorFlow Lite or TensorFlow 1 frozen-graph models.
  • Prepare models for CPU, Apple Metal, NVIDIA CUDA or WebAssembly runtimes.
  • Convert models to NNEF at build time and package a smaller runtime.
  • Build streaming inference workflows using pulsification.
Before you choose

Requirements & limits

  • The README specifies Rust 1.91.0 or newer for the Rust workflow.
  • Use the public tract crate; the README says internal crates are not stable public interfaces.
  • Model format and operator requirements affect deployment: ONNX-only operators may require tract-onnx-opl, and pulsified models may require tract-pulse-opl.
  • The documented runtime options include CPU, Apple Metal, NVIDIA CUDA and WebAssembly; select based on the intended target.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Run an ONNX model with tract in a Rust application

Load, prepare, and run an ONNX model using tract’s default runtime.

Before you start

  • Rust compiler version 1.91.0 or later.
  • The public tract crate and an ONNX model file.
  • An input value convertible with tract’s ndarray interoperability.

Steps

  1. Import tract::prelude::* and enable interoperability with tract::impl_ndarray_interop!().

  2. Load the ONNX model with tract::onnx()?.load("mobilenetv2-7.onnx")?.into_model()?.

  3. Select the default runtime using tract::runtime_for_name("default")? and prepare the model with runtime.prepare(model)?.

  4. Run the prepared model with runnable.run([input.tract()?])?.

Expected outcome

The model’s inference result is returned by `run`.

Guide limitations

  • The example assumes an ONNX model and input value are available; input construction and preprocessing are not specified.
  • The README identifies tract as the authoritative public API and cautions against depending directly on internal crates.
  • The example does not document error handling beyond propagating errors with ?.
Source-based practical guide

Convert a model to NNEF and prepare a compact tract runtime

Use the documented build-time conversion and runtime composition workflow for an NNEF model.

Before you start

  • A model in ONNX, TensorFlow, or TensorFlow Lite format.
  • The tract CLI for conversion.
  • A runtime build that includes tract-core and tract-nnef.

Steps

  1. At build time, convert the source model to NNEF with tract model.onnx dump --nnef model.nnef.tgz, substituting the appropriate source model path and format.

  2. At runtime, include tract-core and tract-nnef.

  3. If the model uses ONNX-only operators, also include tract-onnx-opl; if it is pulsified, also include tract-pulse-opl.

Expected outcome

The workflow separates model conversion from runtime loading and uses the documented NNEF-based runtime components.

Guide limitations

  • The CLI example uses an ONNX input; commands for TensorFlow or TensorFlow Lite conversion are not shown.
  • The README does not provide build-system instructions or a runtime execution example for the converted archive.
  • tract-OPL extensions are described as more in flux than NNEF parts; the stated compatibility rule is for serialized tract 0.x.y models with tract 0.x.z where z >= y.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
16 October 2026
Original website title
sonos/tract · Official homepage title · retained in its source language