Custom providers
Connect new backends and devices to existing toolchains.
You don’t always need to create a new toolchain from scratch. If the existing compiler, profiler, or invoker already handles the model format you need, you can register a custom provider that adds support for running on a new backend or device type.
Overview
A provider is a function registered on an existing component that
handles execution for a specific provider type. For example, the built-in ONNXRuntimeCompiler has providers for qai-hub and embedl-onnxruntime.
You can register additional providers for your own backends.
This is useful when you:
- Have a custom compilation or profiling tool that works with a supported model format (TFLite, ONNX Runtime, TensorRT).
- Want to connect existing toolchains to a new cloud service or device type.
- Need to customize how models are transferred or executed on your hardware.
Registering a provider on an existing component
Use the @Component.provider decorator on the existing component class:
The provider function's keyword arguments must match the component's run() method exactly. Check the component's signature before
writing your provider.
Creating a device configuration
If your provider needs custom settings (paths, flags, etc.), create a ProviderConfig subclass:
Then create devices with this config:
Accessing the configuration inside a provider
Inside your provider function, retrieve the typed configuration from the device:
Per-component configuration overrides
You can provide different configurations for different components on the same device. For example, using a different backend path for compilation vs. profiling:
Provider type strings
Provider types are plain strings. The built-in ProviderType enum provides
well-known values (LOCAL, QAI_HUB, AWS, EMBEDL_ONNXRUNTIME, TRTEXEC), but any string works:
Example: Adding SSH support to an existing compiler
Here’s a full example that adds a new SSH-based provider to the existing TFLiteCompiler:
Next steps
- See custom toolchains to learn how to create entirely new toolchain components.
- See the providers guide for the full reference of built-in providers.