Views
No views yet
stip tutorial
notebooks, so that a tutorial can demonstrate sampling without spending ten
minutes training first. They are toy models (a two-layer MLP, 18k-25k parameters,
trained for 3000 steps on a 4-component 2D Gaussian mixture) and have no
use outside the notebooks.stip's own TrainingIOHandler, holding params, opt_state, ema_params and
extra (EMA decay and step count) as separately-restorable items.conditioning_and_guidance/tutorials/notebooks/4.conditioning_and_guidance.ipynb. Both models are
VelocityOneSidedGenerativeModels with a FlowMatchingOneSidedInterpolant, but over
different modalities:| Path | Model | Modalities | Role in the notebook |
|---|---|---|---|
conditioning_and_guidance/joint_model | Unconditional cross-modal MLP | coordinates (continuous, 2D) and index (discrete, 4 categories) | Intrinsic guidance (Section 3): conditioning a model that was never trained to be conditional |
conditioning_and_guidance/context_model | The same MLP plus a label context path, trained with 50% context dropout | coordinates only; the corner label is passed as context_data instead of as a modality | Context conditioning and classifier-free guidance (Sections 4-5) |
1from flax import nnx
2from huggingface_hub import snapshot_download
3from stip.training.checkpointer import Checkpointer, CheckpointerConfig
4
5path = snapshot_download(
6 "InstaDeepAI/STIP-tutorials", allow_patterns="conditioning_and_guidance/joint_model/*"
7)
8gen_model = ... # build the same model structure as the notebook
9graphdef, params = nnx.split(gen_model, nnx.Param)
10checkpointer = Checkpointer(
11 CheckpointerConfig(
12 checkpoint_dir=f"{path}/conditioning_and_guidance/joint_model",
13 max_to_keep=None, # read-only: never mutate a downloaded directory
14 )
15)
16gen_model = nnx.merge(graphdef, checkpointer.restore_ema(params))restore_ema reads only ema_params and extra, and applies the same bias
correction the training loop uses for evaluation.uv run python tutorials/scripts/train_conditioning_checkpoints.py