Documentation
Hardware Acceleration

Hardware Acceleration

AnyLabeling v0.4.39 and newer select ONNX Runtime execution providers consistently across operating systems. Every accelerated provider is followed by CPU fallback when the installed runtime supports it.

Recommended setup

The easiest supported configurations are:

HardwareInstall or artifactDevice setting
NVIDIA GPU on Linux/Windowsanylabeling-gpu or a GPU-x64 binaryAutomatic, or CUDA
Apple Siliconanylabeling[macos] or a macOS GPU ZIPAutomatic in the GPU build, or COREML
Windows GPU through DirectMLReplace ONNX Runtime with onnxruntime-directmlDIRECTML
Intel CPU/GPU/NPUReplace ONNX Runtime with onnxruntime-openvinoOPENVINO or INTEL_NPU

Keep each runtime in a separate environment. Installing multiple ONNX Runtime distributions together can overwrite shared package files.

Select a device

Set ANYLABELING_DEVICE before starting the application.

Linux or macOS:

export ANYLABELING_DEVICE=CUDA
anylabeling

Windows PowerShell:

$env:ANYLABELING_DEVICE = "DIRECTML"
anylabeling

Supported values are:

ValueONNX Runtime providerNotes
CPUCPUDefault for the CPU distribution
GPU or AUTOBest available providerUses AnyLabeling's deterministic priority order
CUDANVIDIA CUDADefault for Linux/Windows GPU builds
COREMLApple CoreMLApple Silicon acceleration
DIRECTML or DMLMicrosoft DirectMLRequires a DirectML-enabled runtime
OPENVINOIntel OpenVINOIntel CPU/GPU or runtime-selected hardware
TENSORRTNVIDIA TensorRTExplicit opt-in; falls back through CUDA and CPU
ROCM / MIGRAPHXAMD GPU providersRequires a compatible custom runtime
WEBGPUWebGPURequires a runtime exposing the provider

If a requested provider is unavailable, AnyLabeling logs a warning and uses CPU rather than failing startup.

NVIDIA CUDA

Create a fresh environment and install the GPU distribution:

conda create -n anylabeling-cuda python=3.12
conda activate anylabeling-cuda
python -m pip install anylabeling-gpu

anylabeling-gpu currently pins ONNX Runtime below 1.27 for CUDA 12 driver compatibility and installs the pip CUDA/cuDNN libraries. TensorRT is deliberately not selected automatically, even when ONNX Runtime advertises it, because the additional TensorRT libraries and model compatibility are not guaranteed.

DirectML

DirectML can use supported Windows GPUs, including non-NVIDIA devices:

conda create -n anylabeling-directml python=3.12
conda activate anylabeling-directml
python -m pip install anylabeling
python -m pip uninstall -y onnxruntime
python -m pip install onnxruntime-directml
$env:ANYLABELING_DEVICE = "DIRECTML"
anylabeling

ONNX Runtime classifies DirectML as being in sustained engineering, so model/operator support may differ from CUDA.

Intel OpenVINO and NPU

For Intel hardware, use the OpenVINO runtime in its own environment:

conda create -n anylabeling-openvino python=3.12
conda activate anylabeling-openvino
python -m pip install anylabeling
python -m pip uninstall -y onnxruntime
python -m pip install onnxruntime-openvino
export ANYLABELING_DEVICE=OPENVINO
anylabeling

On an Intel Core Ultra system with a supported NPU, use INTEL_NPU. AnyLabeling passes device_type=NPU to OpenVINO.

Other NPUs

AnyLabeling can request providers supplied by vendor-specific ONNX Runtime builds:

HardwareDevice valueProvider behavior
Intel Core Ultra NPUINTEL_NPU or OPENVINO_NPUOpenVINO with device_type=NPU
Qualcomm Snapdragon X NPUQUALCOMM_NPU or SNAPDRAGON_NPUQNN with the HTP backend
AMD Ryzen AI NPUAMD_NPU or RYZENAIVitis AI
Huawei AscendASCEND_NPU or CANNCANN

NPU chooses the first available provider in the order QNN, OpenVINO, Vitis AI, then CANN. Prefer the vendor-specific value when you know the target.

These options require the matching vendor runtime, drivers, supported operating system, and a model whose operators and data types are supported by that provider. Qualcomm HTP generally requires a QDQ-quantized model. Provider availability alone does not guarantee that every AnyLabeling model can run entirely on the accelerator.

Refer to the official ONNX Runtime documentation for execution providers (opens in a new tab), OpenVINO (opens in a new tab), and QNN (opens in a new tab).

Confirm the selected provider

Run this inside the same environment as AnyLabeling:

python -c "from anylabeling.services.auto_labeling.runtime import get_onnx_providers; print(get_onnx_providers())"

The first item is the preferred provider. CPUExecutionProvider at the end is the fallback.