OnnxBackendConfig#
- class openstef_foundation_models.presets.forecasting_workflow.OnnxBackendConfig(*, kind: Literal['onnx'] = 'onnx', providers: list[CpuProvider | CudaProvider | TensorRTProvider | CoreMLProvider] | None = None, policy: DefaultProviderPolicy = DefaultProviderPolicy(kind='default'), session_options: SessionOptionsConfig | None = 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:
kind (
Literal['onnx'])providers (
list[CpuProvider|CudaProvider|TensorRTProvider|CoreMLProvider] |None)policy (
DefaultProviderPolicy)session_options (
SessionOptionsConfig|None)
- kind: Literal['onnx']
- providers: list[CpuProvider | CudaProvider | TensorRTProvider | CoreMLProvider] | None
- policy: DefaultProviderPolicy
- session_options: SessionOptionsConfig | None
- build(checkpoint: LocalCheckpoint | HubCheckpoint) 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.- Return type:
- Returns:
A ready-to-run backend wrapping the resolved checkpoint.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': False, 'extra': 'ignore', 'protected_namespaces': ()}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].