Skip to main content

config

Config for the model inference step (v1).

Module

Global variables

  • DEFAULT_INFERENCE_BATCH_SIZE - Default inference batch size when the config leaves batch_size unset. 1 is the only universally-safe value: some models (e.g. the ophthalmology exam-level models) aggregate a whole batch into a single prediction, so batching independent files together silently collapses/corrupts per-file results. Callers that know their model emits one prediction per input row may set a larger value explicitly for throughput.

Classes

ModelInferenceConfig

class ModelInferenceConfig(**data: Any):

Config for model inference (fovea or GA).

batch_size is optional and defaults to DEFAULT_INFERENCE_BATCH_SIZE (1) when unset — see resolved_batch_size. The remaining fields are required and provided by the YAML template.

Note: this step caches RAW model output. Format-specific postprocessing is applied just-in-time inside the consuming calc step (see bitfount.preprocessing), so there is no postprocessors field here.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables

  • static batch_size : int | None
  • static model_config
  • static model_ref : str
  • static model_username : str
  • static model_version : int
  • resolved_batch_size : int - Effective batch size, defaulting to 1 when batch_size is unset.

    1 is safe for every model; see DEFAULT_INFERENCE_BATCH_SIZE.

Methods


get_model_ref

def get_model_ref(self)> ModelInferenceConfig:

Return self — the config already contains all model ref fields.

This method exists for backward compatibility with code that previously used BitfountModelRef.