Run multistage training¶
Multistage training is an alternative to normal training for EncodeProcessDecode models.
Instead of training the full model in one pass, each component is trained in isolation before the weights are loaded into the full model for a final finetuning step.
This can be useful when the model is large, when encoder inputs have very different characteristics, or when you want finer control over the training of individual components.
The four stages¶
Stage 1 - Train encoders
Each encoder is trained independently as a standalone autoencoder (encoder + disposable decoder). One training run per encoder.
CryoCast trains one encoder for each input group. It does not train an encoder for the target group, unless the target group is also an input.

Stage 2 - Train decoder
The decoder is trained on the combined frozen encoder latents from stage 1.

Stage 3 - Train processor
The processor is trained with frozen encoders and decoder from stages 1–2.

Stage 4 - Finetune
Pretrained weights are loaded into the full EncodeProcessDecode model and the entire model is trained end-to-end.
Some processors calculate their loss in latent space, for example DiffusionProcessor.
To train the decoder in this stage, set loss_weights.reconstruction or loss_weights.prediction (or both) above 0.
If both weights are 0 (the default), the decoder stays frozen.
See Loss in latent space.

Running staged training¶
A checkpoint is saved at the end of each stage. To resume a partially completed run, pass --checkpoint-dir pointing at the checkpoint directory from the original run - any stage whose checkpoint already exists there will be skipped:
uv run cryocast train --multistage --checkpoint-dir ${BASE_DIR}/training/wandb/run-<date>-<id>/checkpoints
Diffusion checkpoints from earlier versions
The diffusion processor now predicts all the channels of the latent space, not only the target channels.
Thus, the output width of the processor has changed.
Checkpoints from earlier DiffusionProcessor runs do not load.
This applies to cnn_ddpm_cnn, cnn_ddim_cnn, dc_ddpm_dc and dc_ddim_dc.
Train these models again.
Checkpoints from other models still load.
Their stored target_encoder weights are no longer used, so CryoCast ignores them.
Earlier multistage runs also saved an encoder-target.*.ckpt checkpoint.
CryoCast does not use this checkpoint now.
To continue one of these runs with --checkpoint-dir, remove the processor.*.ckpt files first.
CryoCast then uses the encoder and decoder checkpoints, and trains the processor again.
Per-stage config overrides¶
Each stage inherits the top-level train config.
To override settings for a specific stage, add a block under the multistage key:
train:
trainer:
max_epochs: 20
multistage:
encoders:
trainer:
max_epochs: 10
decoder:
trainer:
max_epochs: 10
processor:
trainer:
max_epochs: 10
finetune:
optimizer:
lr: 1e-4
trainer:
max_epochs: 5
Any key valid under train can be overridden per stage: optimizer, scheduler, trainer, and callbacks.
Keys not present in a stage block fall back to the top-level train values.
For example, the lr for the encoders, decoder and processor stages would be the default 5e-3 if not overridden elsewhere.