Runtime
-
Description:
capybara.runtimeprovides registries ofRuntimeandBackend, describing the mapping between an inference runtime and the actual execution backend (provider/device). -
Common runtimes
Runtime.onnx: ONNXRuntimeRuntime.openvino: OpenVINORuntime.pt: TorchScript (PyTorch)
-
Common operations
Runtime.<name>.available_backends(): Returns the supported backends of the runtime (in defined order).Runtime.<name>.normalize_backend(backend): NormalizesNone/str/BackendtoBackend(Noneuses the default backend).Runtime.<name>.auto_backend_name(): Chooses a backend based on the environment (e.g. prefer CUDA when available).
-
Notes
- When multiple runtimes are involved,
Backend.from_any(value, runtime=...)requiresruntime; otherwise it raisesValueError(current behavior).
- When multiple runtimes are involved,
-
Example
from capybara.runtime import Runtime
runtime = Runtime.onnx
print([b.name for b in runtime.available_backends()])
print(runtime.auto_backend_name())