nemo_automodel.components.models.muse_spark.model
nemo_automodel.components.models.muse_spark.model
Native AutoModel implementation of the Muse Spark Open Omni model.
Module Contents
Classes
Functions
Data
API
Bases: HFCheckpointingMixin, Module, MoEFSDPSyncMixin
Native Muse Spark Open text, image/video, and waveform-audio model.
Encode waveform values into normalized [tokens,H] features.
Build normalized text embeddings and splice all supplied modalities.
Return whether this module is a partial pipeline stage.
Select global media features for one packed CP rank.
Parameters:
Global feature stream shaped [global_media_tokens,H].
Boolean mask over local packed tokens, shape [T_local].
Boolean mask over the unsharded packed stream, shape
[T_global]; required together with local_indices.
Global indices for every local token, shape
[T_local].
Returns: torch.Tensor
Feature rows corresponding to true entries in local_mask, in
Apply the checkpoint’s parameterless embedding norm to [tokens,H] media.
Splice [media_tokens,H] features into BSHD or THD token embeddings.
Validate packed document lengths and return the real maximum length.
Encode flattened image/video patches into normalized [tokens,H] features.
Map generated PP FQNs to Muse Spark Open’s real multimodal layout.
Parameters:
Auto-generated module FQNs for each stage.
Prefix used for the text decoder, normally model..
Resolved text module supplied by the PP splitter; unused.
Returns: list[list[str]]
Stage module FQNs with the top-level vision/audio towers and
Run causal language modeling for BSHD or packed THD multimodal inputs.
Parameters:
Token ids [batch, sequence] or packed [tokens]. Under PP, stage zero receives global ids and later stages receive CP-local floating-point activations [batch, local_sequence, hidden] here.
Optional embeddings [batch, sequence, hidden] or packed [tokens, hidden]; already local when received from a PP stage.
Local positions [batch, local_sequence] or [local_tokens].
Optional attention mask broadcastable to [batch, heads, sequence, sequence].
Optional local targets [batch, local_sequence] or [local_tokens].
Image patches [patches, patch_features].
Image patch grids [images, 3] in temporal/height/width order.
Video patches [patches, patch_features].
Video patch grids [videos, 3].
Mono waveforms [samples] or [samples, 1], supplied as one tensor or a list of variable-length tensors.
Final token count, or indices [kept_tokens]; zero selects every position.
Attention/packing metadata and model-owned media coordinates. _thd_local_indices [local_tokens] selects from the current microbatch’s global padded stream; global media masks cover that full stream. PP may add a leading singleton microbatch dimension.
Returns: CausalLMOutputWithPast | tuple[torch.Tensor, ...] | torch.Tensor
Causal LM output with logits [batch, local_sequence, vocab] and hidden
Construct the native model from a resolved checkpoint config.
Return the text token embedding module.
Return the untied language-model head.
Build exact PP input/output metadata without a probe forward.
Parameters:
Whether this is the first physical pipeline stage.
Number of samples in one pipeline microbatch.
Global token length presented to stage zero, for both ordinary BSHD and packed THD batches.
Framework-selected compute dtype for final logits or fused loss inputs. Intermediate PP activations follow the model’s residual dtype, independently of the parameter/compute dtype. FSDP must preserve these natural model output dtypes.
Returns: tuple[torch.Tensor, ...]
A pair (inputs_meta, outputs_meta). Token ids have layout
Initialize every parameter for checkpoint-free construction.
Select BSHD round-robin or packed TE THD context-parallel preparation.
Parameters:
Token tensors of shape [batch, sequence], packed real/padded lengths of shape [batch, documents], and optional media payloads.
Number of independently scheduled PP microbatches.
Returns: dict[str, Any]
Model-owned sharder and metadata. Global media masks have shape
Replace the text token embedding module.
Replace the untied language-model head.
Keep the checkpoint-trained, non-updating router correction bias fixed.
Bases: Module
Muse Spark Open decoder backbone with an FP32 residual stream.
Embed [B,S] or packed [T] ids and apply the parameterless norm.
Run BSHD or packed THD decoder activations.
Parameters:
Local token ids [batch, sequence] or packed [tokens].
Local embeddings [batch, sequence, hidden] or [tokens, hidden].
Local positions [batch, sequence] or packed [tokens].
Token validity [batch, sequence] (True/1 means valid), or a prepared attention mask broadcastable to [batch, heads, sequence, sequence].
Local token padding [batch, sequence] or [tokens], with True meaning padding. Takes precedence over attention_mask.
Whether to return each layer’s residual states.
Attention backend metadata, including packed sequence boundaries.
Returns: BaseModelOutputWithPast
Decoder output with last_hidden_state [batch, sequence, hidden] or
Build an SDPA allow-mask for BSHD hidden states.
Parameters:
Input activations shaped [B,S,H].
Optional padding mask [B,S] or ready SDPA mask
broadcastable to [B,heads,S,S].
Number of causal key positions visible to each query, or None for full causal attention.
Returns: torch.Tensor
Boolean SDPA mask shaped [B,1,S,S] (or the caller-provided
Resolve the checkpoint residual-stream dtype.
Select the local round-robin positions from a BSHD position stream.
Parameters:
Full [B,S] or already-local [B,S/cp] positions.
Unpadded global sequence length.
Global positions retained by this CP rank, shape
[padded_sequence/cp].
BSHD batch size.
Device on which default positions are constructed.
Returns: torch.Tensor
Local position ids with shape [B,padded_sequence/cp].