kempnerforge.config.job

Top-level job configuration aggregating all sub-configs.

Classes

JobConfig

Top-level configuration aggregating all sub-configs.

class kempnerforge.config.job.JobConfig[source]

Bases: object

Top-level configuration aggregating all sub-configs.

The VLM stack lives as three sibling top-level sections, [vision_encoder] / [adapter] / [vlm]. A pure text run leaves all three at None and writes only [model] (plus the other operational sections). A VLM run sets [vlm] and is required to provide [vision_encoder]; [adapter] defaults to the registered 2-layer MLP and may be omitted.

model: ModelConfig
train: TrainConfig
optimizer: OptimizerConfig
scheduler: SchedulerConfig
data: DataConfig
eval: EvalConfig
distributed: DistributedConfig
checkpoint: CheckpointConfig
metrics: MetricsConfig
profiling: ProfilingConfig
vision_encoder: VisionEncoderConfig | None = None
adapter: AdapterConfig | None = None
vlm: VLMConfig | None = None
video: VideoConfig | None = None
plugins: list[str]
property images_per_document: int

the image cap, or one clip on a video run.

Type:

Images one document may hold

property is_vlm: bool

Whether this job builds a VLMWrapper around the text backbone.

property is_video: bool

Whether this job trains on a video dataset (a VLM sub-mode).

property views_per_sample: int

a clip’s frames, a tiled image’s views, or one.

Type:

Images the encoder sees per sample

masks_frames_in_backend_attention()[source]

Whether a frame mask reaches self-attention that runs under model.sdpa_backend.

The modality strategy, which the vlm section’s arch picks, masks padded frames in self-attention under Joint-Decoder, MoT and MoMa; Cross-Attention masks them in its cross-attention layers only. The model’s attention, which the section’s class picks, runs SDPA under the configured backend except under MoT. A section whose arch an override changed is judged by both.

Return type:

bool

check_flash_attention_masks()[source]

Refuse sdpa_backend="flash" for a training run whose batches carry a mask.

PyTorch’s CUDA FlashAttention kernel takes no attention mask. Packed rows mask their documents from each other under attention_backend="sdpa", where a run reads them from a dataset (flex turns them into a block mask), and the padded frames of a video run are masked under either backend where masks_frames_in_backend_attention says so: Joint-Decoder and MoMa. The training setup calls this on CUDA, after the CLI overrides and before the process group starts. Evaluation and generation are not checked at setup: on CUDA, a forward there that passes a dense mask to Attention, such as video evaluation’s frame mask under Joint-Decoder or MoMa, raises the ValueError from Attention.forward.

Raises:

ValueError – The run would train with sdpa_backend="flash" and a mask.

Return type:

None

validate(world_size=1, *, training=True)[source]

Run cross-config validations that depend on the world size.

training=False skips the checks that concern only a training run, such as a bf16 gradient reduce without a data-parallel mesh, for a job that computes no gradient (scripts/eval.py).

Parameters:
Return type:

None

__init__(model=<factory>, train=<factory>, optimizer=<factory>, scheduler=<factory>, data=<factory>, eval=<factory>, distributed=<factory>, checkpoint=<factory>, metrics=<factory>, profiling=<factory>, vision_encoder=None, adapter=None, vlm=None, video=None, plugins=<factory>)
Parameters:
Return type:

None