nemo_automodel.components.models.step3p7.model
nemo_automodel.components.models.step3p7.model
Module Contents
Classes
Functions
Data
API
Bases: CausalLMOutputWithPast
CausalLMOutputWithPast plus optional per-depth MTP logits.
Subclassing the HF ModelOutput gives this output the standard
logits/hidden_states fields (so "hidden_states" in out and
getattr(out, "hidden_states") behave like every other model and the
fused-CE path can read the final hidden states), while the MTP fields stay
declared dataclass fields so they survive output-restructuring layers like
FSDP2’s mixed-precision output cast, which rebuild ModelOutput
instances from declared fields only.
Bases: HFCheckpointingMixin, Module, MoEFSDPSyncMixin
Native Step3.7 VLM implementation for MedPix fine-tuning with EP and PP.
Run one microbatch with direct or explicitly staged patch-based media.
Parameters:
Token IDs [batch, sequence], or [tokens] for THD.
Optional MTP embeddings [batch, sequence, hidden] propagated by a previous pipeline stage.
Scalar positions matching the token axes.
Optional [batch, sequence] attention eligibility.
Optional boolean padding flags matching token axes.
Optional embeddings [batch, sequence, hidden].
Optional cache positions [sequence].
Number of trailing logits, or indices [selected_tokens].
Include final hidden states in the model output.
Media pixels [images, channels, height, width], patch pixels [patches, channels, height, width], patch counts [images], newline flags [patches], and optional packed cumulative offsets [segments + 1].
Returns: torch.Tensor | Step3p7CausalLMOutput
Logits [batch, sequence, vocab] or a model output containing those
Return a sharder-only CP backend; embed + splice + shard happen in forward.
Embedding and the vision multimodal scatter now run inside forward
per microbatch (see the CP branch that calls get_multimodal_embeddings
prepare_inputs_embeds+shard_sequence_for_cp_round_robin). The returnedContextParallelSharderround-robin-shards only the no-grad aux streams (labels/position_ids/loss_mask/padding_mask) and leavesinput_idsand the media inputs full-length for the forward. Step3.7 uses plain 1-D positions, so noposition_idsare computed here (the aux shard injects and slices them).
Parameters:
The full-sequence batch (with input_ids [batch, sequence]); left intact.
Accepted for hook-signature parity; unused (round-robin CP).
Bases: Module
Step3.7 VLM wrapper using the native Step3.5 MoE language backbone.