InferenceBackend#

class openstef_foundation_models.inference.backend.InferenceBackend(*args, **kwargs)[source]

Bases: Protocol

A model-agnostic execution backend.

A backend takes a mapping of named input tensors to a mapping of named output tensors. It owns whatever runtime resources are needed (e.g. an ONNX Runtime session) and is loaded once, then reused across an entire backtest. Model-family specifics live in metadata, not in the backend itself.

property metadata: CheckpointMetadata

Metadata describing the checkpoint this backend executes.

run(inputs: Mapping[str, ndarray]) Mapping[str, ndarray][source]

Execute the model on a batch of named input tensors.

Parameters:
  • inputs (Mapping[str, ndarray]) – Named input tensors. Keys must match metadata.input_names.

  • inputs

Returns:

Named output tensors, including metadata.output_name.

Return type:

Mapping[str, ndarray]

close() None[source]

Release any runtime resources held by the backend.

Return type:

None

__init__(*args, **kwargs)