mirror of
https://github.com/pykeio/ort
synced 2026-04-25 16:34:55 +02:00
34 lines
3.5 KiB
Plaintext
34 lines
3.5 KiB
Plaintext
---
|
|
title: Cargo features
|
|
---
|
|
|
|
import Ort from '../../components/Ort';
|
|
|
|
# Cargo features
|
|
|
|
> *✅ = default, ⚒️ = not default*
|
|
|
|
- ✅ **`ndarray`**: Enables tensors to be created from/extracted to [`ndarray`](https://crates.io/crates/ndarray) multi-dimensional arrays. We highly recommend this feature if you need to do a lot of complex pre/post-processing requiring multi-dimensional array access, but for something like an LLM, omitting this feature won't require too much extra work but will save a fair amount of compile time.
|
|
- ✅ **`download-binaries`**: Downloads prebuilt binaries from pyke's CDN service for supported platforms. Disabling this means you'll need to compile ONNX Runtime from source yourself, and [link <Ort/> to it](/setup/linking).
|
|
- ✅ **`copy-dylibs`**: In case dynamic libraries are used (like with the CUDA execution provider), creates a symlink to them in the relevant places in the `target` folder to make [compile-time dynamic linking](/setup/linking#compile-time-dynamic-linking) work.
|
|
- ✅ **`tracing`**; Log messages through the [`tracing`](https://crates.io/crates/tracing) crate for simple & configurable logging. When disabled, ONNX Runtime will instead log directly to `stderr`; see [Logging](/troubleshooting/logging) to configure.
|
|
- ⚒️ **`half`**: Enables support for creating & extracting float16/bfloat16 tensors via the [`half`](https://crates.io/crates/half) crate. ONNX models that are converted to 16-bit precision will typically convert to/from 32-bit floats at the input/output, so you will likely never actually need to enable this feature.
|
|
- ⚒️ **`num-complex`**: Enables support for creating & extracting complex32/complex64 tensors via the [`num-complex`](https://crates.io/crates/num-complex) crate.
|
|
- ⚒️ **`preload-dylibs`**: Enables [dynamic library preloading](https://docs.rs/ort/latest/ort/util/fn.preload_dylib.html); useful if you want to ship CUDA alongside your application instead of requiring the user to install it themselves.
|
|
- ⚒️ **`load-dynamic`**: Enables [runtime dynamic linking](/setup/linking#runtime-loading-with-load-dynamic), which alleviates many of the troubles with compile-time dynamic linking and offers greater flexibility.
|
|
- ⚒️ **`alternative-backend`**: Disables linking to ONNX Runtime, allowing you to instead configure an [alternative backend](/backends).
|
|
- ⚒️ **`pkg-config`**: Enables linking to `libonnxruntime` via `pkg-config`.
|
|
- ⚒️ **`fetch-models`**: Enables the [`SessionBuilder::commit_from_url`](https://docs.rs/ort/latest/ort/session/builder/struct.SessionBuilder.html#method.commit_from_url) method, allowing you to quickly download & run a model from a URL. This should only be used for quick testing.
|
|
|
|
## TLS features
|
|
One of these is required to be enabled when `download-binaries` is enabled, as `download-binaries` always uses HTTPS.
|
|
- ✅ **`tls-native`**: Uses the platform's native TLS provider for broadest compatibility & fastest compile times.
|
|
- ⚒️ **`tls-rustls`**: Uses [`rustls`](https://crates.io/crates/rustls) with [`ring`](https://crates.io/crates/ring) as its crypto provider.
|
|
- ⚒️ **`tls-native-vendored`**: Uses a vendored copy of OpenSSL on Linux.
|
|
|
|
## Execution providers
|
|
Each [execution provider](/perf/execution-providers) is also gated behind a Cargo feature. Each EP's Cargo feature must be enabled for it to be usable; see the linked page for details & the full list of EP features.
|
|
|
|
## Version features
|
|
The minimum ONNX Runtime version required by <Ort/> is controlled via `api-*` features. See [Multiversioning](/setup/multiversion) for more info.
|