OnnxBackendConfig#
- class openstef_foundation_models.presets.OnnxBackendConfig(**data: Any) None[source]#
Bases:
BaseConfigCompute configuration for an ONNX Runtime inference backend.
Holds only how to run the model (execution providers, session options), not which weights: the checkpoint is supplied to
build()by the caller, so the same compute settings can run different checkpoints.- Parameters:
data (
Any)
- providers: list[Annotated[CpuProvider | CudaProvider | TensorRTProvider | CoreMLProvider, FieldInfo(annotation=NoneType, required=True, discriminator='kind')]] | None#
Ordered execution providers to try. ``None`` lets :attr:`policy` pick a host-appropriate chain from the checkpoint metadata (graceful). An explicit list is used exactly as given (strict: a missing accelerator raises).
- policy: DefaultProviderPolicy#
Selection policy used when :attr:`providers` is None. Maps the checkpoint’s precision and static-shape-ness plus the host to an ordered provider chain. Replace it (e.g. a subclass overriding select) to target hardware the default does not cover.
- session_options: SessionOptionsConfig | None#
Optional ONNX Runtime session options.
- build(checkpoint: Annotated[LocalCheckpoint | HubCheckpoint, FieldInfo(annotation=NoneType, required=True, discriminator='kind')]) InferenceBackend[source]#
Resolve checkpoint and build the ONNX Runtime backend.
Importing the backend raises
MissingExtraErrorif ONNX Runtime is not installed.- Parameters:
checkpoint (
LocalCheckpoint|HubCheckpoint) – The checkpoint (weights + metadata) to load and run.checkpoint
- Returns:
A ready-to-run backend wrapping the resolved checkpoint.
- Return type: