Config sections¶
JobConfig aggregates ten typed sub-configs that every run has, plus four
VLM sections that stay None unless the config sets them, except that a
[vlm] run without [adapter] gets the default adapter. Each one lives
in its own module under
kempnerforge/config/
and declares its fields with dataclass defaults. TOML sections map
one-to-one onto these dataclass attributes:
[model] # → config.model (ModelConfig)
[train] # → config.train (TrainConfig)
[optimizer] # → config.optimizer
[scheduler] # → config.scheduler
[data] # → config.data
[eval] # → config.eval
[distributed] # → config.distributed
[checkpoint] # → config.checkpoint
[metrics] # → config.metrics
[profiling] # → config.profiling
[vlm] # → config.vlm (the class its arch registers)
[vision_encoder] # → config.vision_encoder (VisionEncoderConfig)
[adapter] # → config.adapter (AdapterConfig)
[video] # → config.video (VideoConfig)
JobConfig¶
Owns the sub-configs and the cross-section checks, __post_init__ and
validate(world_size).
kempnerforge/config/job.py.
Field |
Type |
Purpose |
|---|---|---|
|
|
architecture + MoE knobs |
|
|
loop-level hyperparameters |
|
|
registry key + LR + betas + optimizer-specific knobs |
|
|
LR schedule shape and warmup |
|
|
dataset sources, mixing, annealing |
|
|
in-loop eval cadence and data source |
|
|
parallelism dims, NCCL timeout |
|
|
DCP save cadence, retention, resume path |
|
|
logging cadence and backends |
|
|
torch.profiler window and trace dir |
|
|
VLM architecture, text length, tiling and freeze; |
|
|
VLM image encoder; |
|
|
VLM connector; a |
|
|
video dataset and frame sampling; requires |
|
|
module paths imported before the config is built, for their registry side effects; see Registry |
plugins is a top-level key, not a section: plugins = ["pkg.module"].
[model]: ModelConfig¶
Architecture hyperparameters and MoE knobs.
kempnerforge/config/model.py.
Dense¶
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
hidden size |
|
|
|
number of transformer blocks |
|
|
|
attention heads |
|
|
|
GQA: |
|
|
|
|
|
|
|
embedding table size |
|
|
|
scales Llama-style |
|
|
|
hard-override the computed FFN width |
|
|
|
registry key for norm builder |
|
|
|
norm epsilon |
|
|
|
MLP activation ( |
|
|
|
RoPE table length; |
|
|
|
RoPE frequency base |
|
|
|
share embedding and output-head weight |
|
|
|
RMSNorm over Q/K per head before RoPE |
|
|
|
weight-init std (GPT-2 / Llama convention) |
|
|
|
|
|
|
|
one of |
|
|
|
|
MoE (all defaults produce a dense model)¶
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
|
|
|
|
experts selected per token |
|
|
|
MoE every N layers (1=all, 2=alternating) |
|
|
|
|
|
|
|
shared experts that always process every token |
|
|
|
coefficient in training loss |
|
|
|
|
|
|
|
sequence-level balance loss (0 = off) |
|
|
|
per-expert gradient normalization |
|
|
|
|
|
|
|
pack expert weights into one tensor per projection |
|
|
|
expert FFN hidden width relative to dense ( |
|
|
|
router-logit z-loss coefficient ( |
Computed properties: is_moe, head_dim, computed_ffn_hidden_dim,
computed_expert_ffn_hidden_dim, mlp_matrices, num_params_estimate.
[train]: TrainConfig¶
Training-loop hyperparameters.
kempnerforge/config/training.py.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
per-device micro-batch size |
|
|
|
tokens per sequence |
|
|
|
training-loop termination |
|
|
|
microbatches per optimizer step |
|
|
|
|
|
|
|
torch/numpy/python RNG seed |
|
|
|
RNG seed for data and batch order; |
|
|
|
wrap the model with |
|
|
|
compute dtype, and the master-weight dtype unless |
|
|
|
keep parameters, gradients and optimizer state in fp32 and compute in |
|
|
|
run fp32 matmuls (a frozen fp32 vision encoder, |
|
|
|
dtype FSDP2 reduce-scatters (and with replicas all-reduces) the transformer’s and adapter’s gradients in; with |
|
|
|
AC policy |
|
|
|
|
|
|
|
logit-magnitude regularizer (PaLM uses |
|
|
|
chunk size for |
|
|
|
compute |
|
|
|
seconds a rank has, from the start of its shutdown (the signal, or for a rank the vote stops, the vote), to finish the step in flight, write and flush the emergency checkpoint and tear down, before a forced exit ( |
|
|
|
NCCL liveness all-reduce every N steps ( |
|
|
|
what the NaN detector does on a step whose loss or gradient norm is NaN / Inf on any rank: |
|
|
|
NaN / Inf steps in a row after which the loop stops, without a checkpoint, for a manual rollback; must be positive; see NaN detection § Rollback recommendation |
Computed properties: param_dtype (compute dtype), master_dtype (storage dtype: fp32 with
fp32_master_weights, otherwise param_dtype), reduce_dtype (from grad_reduce_dtype), is_fp8.
[optimizer]: OptimizerConfig¶
Optimizer settings. name picks the registry builder; the other fields
are shared (AdamW/Lion) or optimizer-specific.
kempnerforge/config/optimizer.py.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
one of |
|
|
|
peak learning rate |
|
|
|
decoupled weight decay, applied to the group |
|
|
|
AdamW / Lion momenta |
|
|
|
numerical safety (AdamW) |
|
|
|
use fused AdamW when available |
|
|
|
Muon momentum coefficient |
|
|
|
Newton–Schulz iterations for Muon |
|
|
|
LR for the parameters Muon leaves to its AdamW fallback; |
|
|
|
Orthogonalize the Nesterov look-ahead instead of the momentum buffer |
|
|
|
Factor on each orthogonalized update |
|
|
|
Newton–Schulz on each rank’s shard, or on the full matrix |
|
|
|
dtype Newton–Schulz iterates in; the momentum and the applied update keep the parameter dtype, so with bf16 parameters (the default without |
|
|
|
Orthogonalize MoE router gates with Muon instead of its AdamW fallback |
|
|
|
internal warmup for schedule-free |
|
|
|
which parameters are decayed; |
|
|
|
per-module learning rates: each |
[scheduler]: SchedulerConfig¶
LR schedule shape and warmup.
kempnerforge/config/scheduler.py.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
|
|
|
|
linear warmup length |
|
|
|
LR factor the warmup starts from (torch |
|
|
|
|
|
|
|
floor = |
|
|
|
WSD: steps at constant LR between warmup and decay |
|
|
|
WSD cooldown shape |
|
|
|
REX exponent: |
[data]: DataConfig¶
Single dataset, HuggingFace source, or mixture; optional phase schedule.
kempnerforge/config/data.py.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
directory of pre-tokenized shards |
|
|
|
glob inside |
|
|
|
dtype of raw |
|
|
|
path or HF id for the tokenizer |
|
|
|
DataLoader workers |
|
|
|
DataLoader pin memory |
|
|
|
DataLoader prefetch factor |
|
|
|
HF dataset id (e.g. |
|
|
|
HF dataset config (e.g. |
|
|
|
HF split |
|
|
|
field to tokenize |
|
|
|
VLM only: image column |
|
|
|
VLM only: prompt column ( |
|
|
|
VLM only: target square image size |
|
|
|
VLM only: images a document may hold; rows holding more are skipped when the dataset is loaded, and one warning counts them. |
|
|
|
use |
|
|
|
document-aware packing with cross-doc isolation (feeds |
|
|
|
multi-dataset mixture of a text run (overrides |
|
|
|
weight scaling; |
|
|
|
multi-phase schedule: LR scaling on any run, weight transitions on a |
|
|
|
syntactic sugar for a common 2-phase annealing pattern of a |
|
|
|
per-dataset weights applied at |
A [video] run builds its dataset from [video], so every hf_* field keeps
its default there; see
Validation rules.
DatasetSource¶
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
pre-tokenized directory |
|
|
|
relative sampling weight (must be |
|
|
|
name for per-dataset metrics and phase weights, one per source; if empty, the source goes by its |
|
|
|
HF dataset id |
|
|
|
HF dataset config |
|
|
|
dtype of this source’s |
Either path or hf_name must be set per source, and no two sources may go
by one name; see
Validation rules.
TrainingPhase¶
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
step at which the phase activates |
|
|
|
per-dataset weights for this phase, keyed by source name; needs a |
|
|
|
multiplier applied to scheduler LR, with or without a mixture |
phases[*].start_step must be strictly increasing; phases and
anneal_start_step are mutually exclusive. A run without a datasets
mixture, on one source or a VLM run, takes neither a phase’s
dataset_weights nor the annealing shortcut, and a VLM run takes no
datasets either; every key of the weights must name a source. See
Validation rules.
[eval]: EvalConfig¶
In-loop evaluation. Disabled by default.
kempnerforge/config/eval.py.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
gate in-loop eval |
|
|
|
eval every N training steps |
|
|
|
eval batches per evaluation; under pipeline parallelism a multiple of |
|
|
|
pre-tokenized eval shards |
|
|
|
glob inside |
|
|
|
dtype of raw |
|
|
|
HF dataset id |
|
|
|
HF dataset config |
|
|
|
HF split |
If enabled=True, at least one of dataset_path / hf_dataset_name
must be set; validate() rejects the combination otherwise.
[distributed]: DistributedConfig¶
Parallelism dimensions and NCCL settings.
kempnerforge/config/distributed.py.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
FSDP shard degree; |
|
|
|
replicates the |
|
|
|
tensor parallel |
|
|
|
pipeline parallel |
|
|
|
pipeline schedule |
|
|
|
context parallel; reserved, not implemented, must be |
|
|
|
expert parallel (MoE only) |
|
|
|
Collective timeout, in seconds, of the default process group and every mesh group |
|
|
|
|
The product dp_replicate × dp_shard × tp × pp × cp × ep must equal
world_size. Methods: validate_world_size(ws), resolve(ws).
[checkpoint]: CheckpointConfig¶
DCP-based checkpointing.
kempnerforge/config/checkpoint.py.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
root directory for |
|
|
|
save every N steps (outside any |
|
|
|
optional dense save phase; see |
|
|
|
DCP async-save mode |
|
|
|
retain the most recent N checkpoints ( |
|
|
|
checkpoint for training to start from while |
|
|
|
dtype for HF exports via |
|
|
|
state to skip when warm-starting from |
|
|
|
load a checkpoint whose VLM freeze metadata disagrees with the configured freeze specs, downgrading the error to a warning |
|
|
|
resume when the saved per-rank dataloader/RNG state does not fit this run (changed world size or data-parallel layout, or an unreadable or incomplete envelope), with a warning instead of raising: step, model, optimizer and scheduler continue and the random streams restart fresh. On a changed world size or layout every rank keeps the data position the saved rank 0 reached, or for a stream on the saved data-parallel size the one its own data-parallel rank saved, where the loaders can place it on the new layout, and otherwise every rank starts the data at its first sample; an unreadable or incomplete envelope restarts the data too. On the topology that saved a sound envelope the flag changes nothing: each rank restores its own state, and a position its loader cannot place, such as a changed stream, still raises |
|
|
|
resume, or warm start with the train state, from a checkpoint saved with another |
|
|
|
load a checkpoint that holds model tensors this run’s model does not have, such as a deeper model’s last layers, and leave them unread with a warning instead of refusing it; a tensor of another size, or one this run loads that the checkpoint lacks, is still refused (see Resharding) |
[checkpoint.dyn_ckpt_window]: DynamicCheckpointWindow¶
Opt-in dense save phase. Inside [start, stop] a registered strategy decides
which steps to save; outside the window the regular interval cadence applies.
Steps saved by the strategy are exempt from keep_last_n retention, so a
finite keep_last_n rotates only the later interval checkpoints; the dense
window checkpoints are never pruned. Useful for inspecting early-training
dynamics at fine granularity.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
first step of the dense window; |
|
|
|
last step of the dense window |
|
|
|
name of a registered strategy (see below) |
Example TOML:
# Off by default, interval cadence only:
[checkpoint]
interval = 1000
keep_last_n = 3
# Opt in with defaults (start=0, stop=512, strategy="power2"):
[checkpoint.dyn_ckpt_window]
# Customize:
[checkpoint.dyn_ckpt_window]
start = 0
stop = 1024
strategy = "power2"
Dyn_ckpt strategies¶
A strategy is a Callable[[DynamicCheckpointWindow, int], bool] registered via
@registry.register_dyn_ckpt_strategy("name") (see
kempnerforge/config/registry.py).
The strategy receives the window and the current training step and returns
True iff the step should be saved. The registry must be populated before
config load, either by kempnerforge itself (the default "power2" is
registered in kempnerforge/config/checkpoint.py) or by an explicit import
of the user’s module.
Name |
Behavior |
|---|---|
|
save at |
[metrics]: MetricsConfig¶
Logging cadence and backend toggles. The backends are independent, so any combination can be
enabled in one run config.
kempnerforge/config/metrics.py.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
log every N steps (stdout + enabled backends) |
|
|
|
turn on WandB backend |
|
|
|
turn on TensorBoard backend |
|
|
|
WandB project name |
|
|
|
|
|
|
|
restored from the checkpoint on an auto-resume, never on a |
|
|
|
TB log directory |
|
|
|
turn on MLflow backend (Databricks or local) |
|
|
|
tracking URI; |
|
|
|
absolute workspace path on Databricks; |
|
|
|
|
|
|
|
run description (Markdown, the |
|
|
|
extra run tags, set on a new run after the automatic ones; keys and values must be non-empty strings |
|
|
|
restored from the checkpoint on an auto-resume, never on a |
|
|
|
sample CPU/GPU/memory on a background thread |
|
|
|
seconds between system-metric samples |
|
|
|
register each committed checkpoint as an MLflow external model on the background worker; |
Credentials never go in config. The auth routes, the URI and experiment resolution, and the bounds on tracking calls are on the MLflow backend page.
[profiling]: ProfilingConfig¶
torch.profiler window.
kempnerforge/config/profiling.py.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
run the profiler during the loop |
|
|
|
first step recorded |
|
|
|
last step recorded (must be |
|
|
|
output directory for Chrome/Perfetto traces |
[vlm]: VLMConfig¶
The vision-language architecture: how image tokens join the transformer,
the fixed text length, image tiling, and which modules train. A run without
[vlm] is a text run. A run with it wraps the transformer in a VLMWrapper,
needs [vision_encoder], and takes the default [adapter] when that
section is absent.
kempnerforge/config/vlm.py.
arch selects the config class. The loader looks it up in the vlm_config
registry and builds the [vlm] table as that class, so the table takes the
fields below plus the ones its arch adds, and a field of another arch fails
to load as an unknown key. When the TOML has a [vlm] section, a
--vlm.arch override naming another arch is rejected, so set arch in the
TOML (see CLI overrides). Code builds one
with VLMConfig.for_arch(arch, **fields).
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
|
|
|
|
text tokens per sample: longer text is truncated to it; without |
|
|
|
|
|
|
|
a tiled image’s views start with the whole image, so it has |
|
|
|
freeze specs applied when the model is built; the default freezes the vision encoder, and |
|
|
|
freeze changes that take effect at a step (see |
|
|
|
module aliases that freeze specs and |
The default module_patterns give each alias its module and everything in
it:
Alias |
Patterns |
Arch |
|---|---|---|
|
|
all |
|
|
all |
|
|
all |
|
|
|
|
|
|
|
|
|
A [vlm.module_patterns] table replaces the whole map, so the default
aliases it leaves out are gone, including the vision_encoder that the
default freeze names. A dotted override sets one alias and keeps the
others (see CLI overrides).
The image tokens must fit the sequence. With vision_encoder.num_tokens > 0,
model.max_seq_len (when JobConfig is built) and train.seq_len (in
JobConfig.validate) must each hold max_text_len plus the image tokens in
the residual stream. Those are the tokens the adapter emits per view, times
the views per image (one, or tile_grid² plus one with tile_global when
tiled; video.max_frames on a [video] run), times the images a document
may hold (data.hf_max_images; one clip on a [video] run).
Cross-Attention keeps image tokens out of the residual stream, so only
max_text_len counts there. The model build checks model.max_seq_len
again once the encoder has reported its token count.
JobConfig also limits what each arch runs with (see
Validation rules):
data.pack_sequencesanddata.hf_max_images != 1needjoint_decoder.[[data.datasets]], a data phase’sdataset_weightsand the annealing shortcut (data.anneal_start_stepwithdata.anneal_weights) are refused for every arch: a VLM run reads its data from thedata.hf_*fields or[video]and builds no mixture. A phase’slr_scalestill applies (see Validation rules).distributed.pp > 1is refused for every arch.distributed.tp > 1is refused formot, and for the other arches while sequence parallelism is on (see Validation rules).distributed.ep > 1is refused formotandmoma.optimizer.lr_multipliersmay name only keys ofmodule_patterns.
A minimal VLM run sets [vlm] and [vision_encoder]:
[vlm]
arch = "joint_decoder"
max_text_len = 128
[vision_encoder]
type = "siglip2"
path = "google/siglip2-base-patch16-224"
arch = "joint_decoder": JointDecoderConfig¶
The image tokens come before the text in the residual stream, and the output
head runs on the text positions. No fields beyond the ones above. The only
arch that takes data.pack_sequences and data.hf_max_images != 1.
arch = "cross_attention": CrossAttentionConfig¶
The residual stream carries text only; the image features enter as the keys
and values of cross-attention blocks between the transformer blocks. Adds
the cross_attention alias to module_patterns.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
a cross-attention block after every |
|
|
|
attention heads of each cross-attention block; |
|
|
|
key/value heads of each cross-attention block; |
arch = "mot": MoTConfig¶
Mixture-of-Transformers: every block holds its own attention projections,
norms and FFN for each modality, and one global self-attention runs over the
image-then-text sequence. Adds the mot alias, which covers the blocks and
leaves out the embedding, the output head and the final norms. MoT trains
with distributed.tp = 1 and distributed.ep = 1.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
modalities with weights of their own; at least two, |
|
|
|
image attention heads; |
|
|
|
image key/value heads; |
|
|
|
copy the dense block weights in |
|
|
|
a |
arch = "moma": MoMaConfig¶
Mixture of Modality-Aware Experts: one set of attention projections, and in
every block an FFN that sends each token to its modality’s group of experts,
where each expert picks the tokens it processes by sigmoid score
(expert-choice routing). Adds the moma alias, which covers the blocks.
Each expert’s choice depends on the whole batch, so MoMa trains but does not
generate (is_generative is False). MoMa needs model.num_experts = 0 and
distributed.ep = 1 (JobConfig.validate), and logs a warning with
train.compile_model.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
modality groups; at least two, |
|
|
|
experts in each group: a positive count for every modality and no other keys |
|
|
|
each expert picks |
|
|
|
add Gumbel noise to the router logits in training |
[[vlm.freeze]]: FreezeSpec¶
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
required |
a key of |
|
|
|
|
Parameter names are the VLMWrapper’s: transformer.*, vision_encoder.*
and adapter.*. A bare word that is not a key of module_patterns, such as
a misspelled alias, fails when the config loads; a pattern that matches no
parameter fails the model build.
[[vlm.freeze_schedule]]: FreezeStage¶
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
required |
step count at which the stage takes effect; |
|
|
required |
the freeze specs the stage applies |
The build applies freeze. Once the step count reaches a stage’s
start_step, its specs apply on top, and for each module the latest stage
replaces what freeze or an earlier stage set; a resume applies freeze and
every stage up to the step it resumes at. A stage may unfreeze a module that
freeze froze: the module trains from that stage on, and its parameters are
in the optimizer from the start. Each checkpoint records the freeze in
effect at its step. A resume, or a warm start from checkpoint.load_path
that loads the train state, compares that record with this run’s freeze at
the same step, and fails when a module both name is frozen in one and
trained in the other, unless checkpoint.ignore_freeze_mismatch is set. A
weights-only warm start
(checkpoint.exclude_from_loading = ["optimizer", "train_state"]) skips the
comparison and starts at step 0 under this run’s freeze (see
[checkpoint]).
Train the adapter alone first, then the transformer too from step 2000. A
freeze list replaces the default one, so this one names vision_encoder
again to keep the encoder frozen:
[vlm]
arch = "joint_decoder"
[[vlm.freeze]]
module = "vision_encoder"
[[vlm.freeze]]
module = "transformer"
[[vlm.freeze_schedule]]
start_step = 2000
specs = [{ module = "transformer", frozen = false }]
[vision_encoder]
type = "siglip2"
path = "google/siglip2-base-patch16-224"
[vision_encoder]: VisionEncoderConfig¶
The image encoder of a VLM run, which turns each image, tile or frame into
patch features for the adapter. [vlm] requires this section; a run without
[vlm] does not use it.
kempnerforge/config/vision.py.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
|
|
|
|
Hub id or local directory of the pretrained model; |
|
|
|
width of the features the encoder returns; |
|
|
|
tokens the encoder returns per image; |
|
|
|
dtype the encoder computes in, independent of |
|
|
|
remove a SigLIP tower’s attention-pooling head, whose pooled output the encoder never returns; only a |
On a VLM run, a Hugging Face encoder with feature_dim or num_tokens above
0 logs a warning when JobConfig is built: the values replace the ones the
encoder reads from its model and can disagree with them. Leave both at 0
unless the model’s config has no hidden_size, which the build then asks to
be given as feature_dim.
drop_pooling_head changes the encoder’s tensors, which a checkpoint holds
whether the encoder trains or not. Loading the model from a checkpoint saved
with the head into a run that drops it is refused unless
checkpoint.ignore_extra_model_tensors is set, which leaves the head’s
tensors unread. The other way round, from a checkpoint saved without the
head into a run that keeps it, is refused, and that flag does not cover it
(see [checkpoint]).
[adapter]: AdapterConfig¶
The VLM connector that maps vision-encoder features into the transformer’s
embedding space. A run that sets [vlm] without [adapter] gets these
defaults.
kempnerforge/config/adapter.py.
Field |
Type |
Default |
Used by |
Purpose |
|---|---|---|---|---|
|
|
|
all |
adapter registry key: |
|
|
|
|
MLP hidden width. |
|
|
|
|
|
|
|
|
|
norm-registry key for a norm ahead of the MLP, over the vision features ( |
|
|
|
|
pooling window side, e.g. |
|
|
|
|
attention heads; must be positive, and divide the vision feature dim when the adapter is built |
A field outside the selected adapter’s “Used by” entries must keep its
default, or the config fails to load with an error naming the field and the
adapter type. The column follows each adapter’s builder parameters, which
avgpool narrows by hidden_dim with the accepts it registers; a plugin
adapter’s come from its own builder (see
Registry).
An avgpool connector with a 2×2 window and an RMSNorm + MLP head as wide as
its input (here a 1152-wide encoder):
[adapter]
type = "avgpool"
pool_window = 2
hidden_dim = 1152
pre_norm = "rmsnorm"
hidden_dim picks the avgpool head, and the head fixes the adapter’s
checkpoint keys. hidden_dim = 0 builds the single Linear, saved as
adapter.proj.weight and adapter.proj.bias. A positive hidden_dim builds
the MLP head, saved as adapter.proj.proj1.* and adapter.proj.proj2.*, plus
adapter.proj.ln_q.* when pre_norm is set. A checkpoint loads only into
the head it was saved with: the other head’s load is refused before any
tensor is read, naming the parameters of that head the checkpoint lacks. To
resume a checkpoint saved with the single Linear, set hidden_dim = 0 and
leave activation and pre_norm at their defaults.
A command-line override sets a value and never restores a default, so
switching adapter.type on the command line keeps every other field the TOML
sets. Reset the ones the new type does not use in the same command; an empty
value sets the empty string. For a TOML with type = "mlp_2layer",
hidden_dim = 2048 and pre_norm = "rmsnorm":
--adapter.type=attentional_pool --adapter.hidden_dim=0 --adapter.pre_norm=
The check reads the TOML with the overrides laid over it, so a field and the
type that uses it may sit in different layers: a TOML with
type = "attentional_pool" and hidden_dim = 1152 loads with
--adapter.type=avgpool, which uses hidden_dim.
[video]: VideoConfig¶
Video input for a VLM run: the job trains on clips, each decoded into frames
that the vision encoder and adapter process like images. Requires [vlm],
and so [vision_encoder]. Decoding needs PyAV (uv sync --group video); see
Train on video.
kempnerforge/config/video.py.
Field |
Type |
Default |
Purpose |
|---|---|---|---|
|
|
|
root directory of the on-disk corpus |
|
|
|
|
|
|
|
corpus within the style; |
|
|
|
|
|
|
|
|
|
|
|
read at most this many manifest entries ( |
|
|
|
frames per clip: a clip with fewer is padded to this many, and the padding is masked; must be at least |
|
|
|
fewest frames the policy samples from a clip of known, positive length ( |
|
|
|
target sampling rate in frames per second; must be positive |
|
|
|
side, in pixels, of the square each frame is resized to; must be positive |
|
|
|
instruction placed before every caption and masked from the loss; must leave room in |
A [video] run keeps vlm.tile_grid = 0, and takes neither
data.pack_sequences nor data.hf_max_images != 1. It builds its dataset
from [video], and from [data] reads tokenizer_path and the loader
settings (num_workers, pin_memory, prefetch_factor).
JobConfig.validate refuses a data.hf_* field set away from its default
(see
Validation rules)
and, as on every VLM run, [[data.datasets]], a data phase’s
dataset_weights and the annealing shortcut, since the run builds no
mixture; a phase’s lr_scale still applies (see
Validation rules).
The residual stream holds max_frames times the adapter’s tokens per frame,
none under Cross-Attention, and with vision_encoder.num_tokens > 0 the
config checks that they fit with vlm.max_text_len (see
[vlm]). The training setup refuses
model.sdpa_backend = "flash" on CUDA for a Joint-Decoder or MoMa video run,
whose padded frames need an attention mask.
Eight frames of 49 tokens each (SigLIP2’s 14×14 patches pooled 2×2) and 64 text tokens take 456 positions:
[model]
max_seq_len = 576
[train]
seq_len = 576
[vlm]
max_text_len = 64
[vision_encoder]
type = "siglip2"
path = "google/siglip2-base-patch16-224"
[adapter]
type = "avgpool"
pool_window = 2
[video]
data_root = "/data/webvid"
max_frames = 8
Where to read next¶
CLI overrides: reshape any of these fields from the command line.
Validation rules: what
__post_init__andvalidate(world_size)enforce.Registry: how the string keys above (
moe_router,norm_type,optimizer.name,scheduler.name,loss_fn,model_type,dyn_ckpt_window.strategy,vlm.arch,vision_encoder.type,adapter.type,video.dataset_type,video.sampling_policy) resolve to builders.