[package] name = "tract" version = "0.23.9" license = "MIT OR Apache-2.0" authors = ["Mathieu Poumeyrol "] description = "Tiny, no-nonsense, self contained, TensorFlow and ONNX inference" repository = "https://github.com/sonos/tract" keywords = ["NeuralNetworks"] categories = ["science"] autobenches = false edition = "2024" rust-version.workspace = true include = ["Cargo.toml", "src/**/*.rs", "LICENSE*", "tests"] [dependencies] anyhow.workspace = true boow.workspace = true erased-serde.workspace = true flate2 = { workspace = true, optional = true } half.workspace = true tract-api.workspace = true tract-core.workspace = true tract-nnef.workspace = true tract-onnx-opl.workspace = true tract-onnx = { workspace = true, optional = true } tract-extra.workspace = true tract-pulse = { workspace = true, optional = true } tract-pulse-opl.workspace = true tract-libcli = { workspace = true, optional = true } tract-transformers = { workspace = true, optional = true } serde_json.workspace = true [target.'cfg(any(target_vendor = "apple"))'.dependencies] tract-metal = { workspace = true, optional = true } [target.'cfg(any(target_os = "linux", target_os = "windows"))'.dependencies] tract-cuda = { workspace = true, default-features = false, optional = true } [dev-dependencies] icu_normalizer.workspace = true icu_properties.workspace = true reqwest.workspace = true rustls.workspace = true tempfile.workspace = true serde_json.workspace = true [features] default = ["cuda-13000", "metal", "flate2", "onnx", "profile", "pulse", "transformers"] complex = [] # Gzip support for NNEF archives: reading `.nnef.tgz` models and writing them # back. Enabled by default; consumers that only load uncompressed NNEF drop # flate2 and miniz_oxide with `default-features = false`. flate2 = ["dep:flate2", "tract-nnef/flate2"] # The ONNX parser: `onnx()`, the `Onnx` loader and the `InferenceModel` / # `InferenceFact` shape-inference types it produces. Enabled by default; # consumers that only load NNEF drop tract-onnx and its operator register with # `default-features = false`. `enable_onnx` is unaffected — the ONNX operators # an NNEF graph may carry live in tract-onnx-opl, which stays either way. onnx = ["dep:tract-onnx"] # `Runnable::cost_json` and `Runnable::profile_json`, backed by tract-libcli. # Enabled by default; with it off both return an error, and tract-libcli, with # clap and its other CLI dependencies, stays out of the build. profile = ["dep:tract-libcli"] # Offline pulsification: the `pulse` and `blockify` model transforms, and the # write side of pulsed NNEF. Enabled by default; consumers that only load and # run an already pulsified model keep `enable_pulse` off tract-pulse-opl alone # with `default-features = false`. Implies `transformers`, which tract-pulse # needs for the DiagGather pulsifier and blockify. pulse = ["dep:tract-pulse", "tract-extra/pulse", "transformers"] # The tract_transformers NNEF extension: attention, KV cache and rope # operators, and the transforms that detect them, plus the ONNX attention # operators that lower onto them and libcli's causal-LLM tensor specs. Enabled # by default; with it off `enable_tract_transformers` fails and a model using # those operators does not load, so only drop it for a model known not to need # them. transformers = ["dep:tract-transformers", "tract-onnx?/transformers", "tract-libcli?/transformers"] # default = [ "dylib" ] # dylib = [] # staticlib = [] # Gates the `extern crate tract_metal` that registers the Metal runtime, on the # Apple targets that have it. Enabled by default; CPU-only consumers drop the # backend, and the shader sources it embeds, with `default-features = false`. metal = ["dep:tract-metal", "tract-libcli?/metal"] # Marker feature implicitly enabled by every cuda-XXXXX selector below. # Gates the `extern crate tract_cuda` that registers the CUDA runtime. # Not meant to be enabled directly — always pick a concrete cuda-XXXXX so # cudarc has an API version to bind against. cuda = [] # CUDA driver-API selectors (linux/windows targets only). Pass-through to # tract-cuda. Exactly one must be active for CUDA support; the default pulls # cuda-13000. CPU-only consumers drop the backend entirely with # `default-features = false`. cuda-12000 = ["cuda", "dep:tract-cuda", "tract-cuda/cuda-12000"] cuda-12010 = ["cuda", "dep:tract-cuda", "tract-cuda/cuda-12010"] cuda-12020 = ["cuda", "dep:tract-cuda", "tract-cuda/cuda-12020"] cuda-12030 = ["cuda", "dep:tract-cuda", "tract-cuda/cuda-12030"] cuda-12040 = ["cuda", "dep:tract-cuda", "tract-cuda/cuda-12040"] cuda-12050 = ["cuda", "dep:tract-cuda", "tract-cuda/cuda-12050"] cuda-12060 = ["cuda", "dep:tract-cuda", "tract-cuda/cuda-12060"] cuda-12080 = ["cuda", "dep:tract-cuda", "tract-cuda/cuda-12080"] cuda-12090 = ["cuda", "dep:tract-cuda", "tract-cuda/cuda-12090"] cuda-13000 = ["cuda", "dep:tract-cuda", "tract-cuda/cuda-13000"] cuda-13010 = ["cuda", "dep:tract-cuda", "tract-cuda/cuda-13010"] cuda-13020 = ["cuda", "dep:tract-cuda", "tract-cuda/cuda-13020"] # Serve many concurrent sessions off one prepared model (`Runnable::autobatch`), # and the `deploy` runtime, which prepares models as a deployment config says. # Unstable: the shape of the surface is still being settled against the server # it is meant for, so it is not covered by the no-breaking-change commitment. unstable-autobatch = ["tract-core/deploy"]