CoreMLProvider#

class openstef_foundation_models.inference.providers.CoreMLProvider(*, kind: Literal['coreml'] = 'coreml', model_format: Literal['MLProgram', 'NeuralNetwork'] = 'MLProgram', compute_units: Literal['CPUOnly', 'CPUAndGPU', 'CPUAndNeuralEngine', 'ALL'] = 'ALL', cache_dir: Path | None = None)[source]

Bases: BaseConfig

The CoreML execution provider (Apple, GPU/Neural Engine).

ModelFormat=MLProgram is required for modern CoreML: the legacy NeuralNetwork format fragments the graph and silently falls back to CPU for many ops.

Parameters:
  • kind (Literal['coreml'])

  • model_format (Literal['MLProgram', 'NeuralNetwork'])

  • compute_units (Literal['CPUOnly', 'CPUAndGPU', 'CPUAndNeuralEngine', 'ALL'])

  • cache_dir (Path | None)

kind: Literal['coreml']
model_format: Literal['MLProgram', 'NeuralNetwork']
compute_units: Literal['CPUOnly', 'CPUAndGPU', 'CPUAndNeuralEngine', 'ALL']
cache_dir: Path | None
to_ort() → OrtProvider[source]

Compile to an ONNX Runtime provider tuple.

Return type:

tuple[str, dict[str, object]]

Returns:

The CoreMLExecutionProvider with format, compute-unit and (optional) cache options.

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].