Training is GPU-only.
The configuration arrives as structs mirroring the C ones field by field, so a field left at its default is zero, which the library derives:
BatchShape nests an ImageShape, a VideoShape and an AudioShape, while Masking, Contrastive, LateInteraction, Choices and Schedule configure the objectives, and PairLossForm picks each contrastive term’s pair loss. Relations holds three Edges sets as compressed sparse rows, which the binding checks against the step’s items before the call.
A step’s sides give each item a LateInteractionSide, and its choices and choice_targets give each choice item its legal bytes and their target probabilities as (data, offsets) tapes, the shapes text_choose takes and answers, checked the same way.
Paths cross as the OS’s bytes on Unix, not necessarily UTF-8, while the mesh’s job is a name and a &str. step answers the pooled embeddings the loss scored when its config names an arena, and None otherwise.
A trainer borrows its mesh, so the mesh outlives every trainer made over it, and mesh.describe() answers a MeshDescription whose multimem_tier is a MultimemTier and whose gpu_class is the GPUClass every GPU of the run dispatches as.
API
StructAudioShapeThe audio slice of a batch envelope; a zero chunk_samples leaves audio out of the run.
Matryoshka prefix widths, strictly ascending, each a multiple of 8, at most 8 of them, every
one scored; empty scores the full width alone. Copied, not borrowed.
temperature_groups
usize
Learnable inverse temperature and bias pairs, one per group a step's items select; one.
inverse_temperature
f32
The starting inverse temperature of every group; 10 under the sigmoid form,
SigLIP's, else 1.
bias
f32
The starting logit bias of every group; −10 under the sigmoid form, SigLIP's, else zero.
StructLateInteractionHow the late-interaction loss scores the per-token vectors of query and document items; every zero derives the default the C header names.
StructRelationsThe contrastive targets of one step, resolved per pair in this order: a pair ignore names is skipped, one attract names pulls together, one repel names pushes apart, and every other pair follows the run's Negatives.
TraitTrainVerbsEvery trainer verb, written once for both receivers of Trainer::on and Trainer::deferred, which run on the executor the trainer was made on.4
Every process of the run calls it
once per step, with one modality per item and each item's bytes in contents.
Answers the pooled embeddings when the config names an arena.
Calls uform_trainer_step.
saveWrites the weights and the step, which the model loads serve and Trainer::init_vram resumes; only the process of index zero writes, the rest return at once.
fn save<'config, Location: AsRef<Path>>(
self,
config: impl Into<TrainerSaveConfig<'config, Location>>,
) -> <<Self as TrainVerbs<'trainer>>::Completion as Completion>::Answer<'trainer, TrainerSave<'config, Location>>
where
Self::Completion: Accepts<TrainerSaveConfig<'config, Location>>,
Calls uform_trainer_save.
StructTrainerA training run: the tower replicas, gradients, optimizer moments, heads, temperatures and the collectives sized by them, on its executor's devices, whose verbs come from TrainVerbs.3
Mirrors uform_trainer_t; dropping it calls uform_trainer_free. 'mesh is the borrow of the
Mesh it was made over.
Implements
Debug, Send, Drop
init_vramBuilds one replica per device of executor, the NVLink domain its consumers reserve over the mesh, and starts or resumes the run; every process of the run calls it with the same geometry, objective and seed.
Each item's legal choices, one byte each, as a (data, offsets) tape like the one
text_choose takes; empty offsets make no choices. Read
when the run trains them: a text item offering any is the state its answer follows, and the
call appends the mask byte, cutting a state longer than a row at its head.
choice_targets
(&'config [f32], &'config [usize])
The target probability of each choice, a (data, offsets) tape whose entries are as long as
those of choices and sum to one, as text_choose answers its probabilities.