nemo_automodel.components.models.muse_glimmer.model
nemo_automodel.components.models.muse_glimmer.model
Native AutoModel implementation of the complete dense MuseGlimmer VLM.
The parameter hierarchy intentionally matches the checkpoint’s Hugging Face
implementation. Text attention is backend-native: PyTorch SDPA is used for the
ordinary backend and Transformer Engine’s DotProductAttention is constructed
directly for TE BSHD/THD execution.
Module Contents
Classes
Functions
Data
API
Bases: Module
MuseGlimmer GQA with Q/K RMSNorm, optional RoPE, output gate, SDPA, and TE.
Bases: GradientCheckpointingLayer
One MuseGlimmer language decoder layer.
Bases: Module
RMSNorm whose checkpoint weight stores the actual output gain.
Bases: HFCheckpointingMixin, MuseGlimmerPreTrainedModel, GenerationMixin
Native complete MuseGlimmer VLM with causal language-modeling head.
Switch native TE modules between ordinary and packed CP transport.
Record real lengths and validate the TE p2p path when CP is active.
Run the vision-language decoder and project the kept positions to scaled vocabulary logits.
Parameters:
Optional token IDs of shape [batch, sequence], or packed (THD) IDs of shape [1, tokens], which the decoder squeezes to [tokens]; give exactly one of input_ids and inputs_embeds.
Optional Tensor of shape [batch, sequence] ([batch, past + sequence] with a cache), 1 at valid tokens and 0 at padding, or, with SDPA or eager attention, a dense mask of shape [batch, 1, sequence, past + sequence]; packed input and context parallelism ignore it.
Optional positions of shape [batch, sequence], or [1, tokens] for packed input, which requires them.
Optional generation Cache; packed input does not support one.
Optional embeddings of shape [batch, sequence, hidden], or packed [1, tokens, hidden].
Optional target IDs of shape [batch, sequence] for the shifted next-token cross-entropy on the returned logits, which ignores -100.
Whether to return the cache; None caches in eval mode only, and packed input never caches.
Ignored; no attention weights are returned.
Passed to the decoder; the output carries the final hidden states regardless.
Whether to return CausalLMOutputWithPast instead of a tuple.
Optional cache positions of shape [sequence].
Optional flattened image patches of shape [patches, patch_features].
Optional int grid of shape [images, 3] holding each image’s (t, h, w) patch counts.
Optional flattened video patches of shape [patches, patch_features].
Optional int grid of shape [videos, 3] holding each video’s (t, h, w) patch counts.
Optional bool mask of shape [batch, sequence], true at media tokens.
0 keeps every position, a positive int keeps the last N positions, and an integer
Tensor of shape [kept] keeps those positions.
Backend metadata for the decoder. Packed input sets qkv_format="thd" and passes
cu_seqlens and cu_seqlens_padded of shape [1, documents + 1], padded with -1000, and
max_seqlen. A padding_mask here is ignored.
Returns: CausalLMOutputWithPast
CausalLMOutputWithPast, or its tuple when return_dict is False. logits have shape
Select native MuseGlimmer CP preparation for BSHD or packed TE THD.
Bases: Module
Bias-free SwiGLU language MLP.
Bases: MuseGlimmerPreTrainedModel
Complete MuseGlimmer vision-language backbone.
Run the decoder on padded or packed (THD) input; packed input comes back batched.
Packed input is squeezed to [tokens, …] for the layers, which TE’s packed kernels take.
Parameters:
Token IDs of shape [batch, sequence], or packed [1, tokens].
Optional Tensor of shape [batch, sequence] ([batch, past + sequence] with a cache), 1 at valid tokens and 0 at padding, or, with SDPA or eager attention, a dense mask of shape [batch, 1, sequence, past + sequence]; packed input and context parallelism ignore it.
Optional positions of shape [batch, sequence], or packed [1, tokens].
Optional generation cache; packed input disables it.
Optional embeddings of shape [batch, sequence, hidden], or packed [1, tokens, hidden].
Whether to return the cache.
Whether to return each layer’s hidden states.
Whether to return BaseModelOutputWithPast instead of a tuple.
Optional token positions of shape [sequence].
Optional flattened image patches of shape [patches, patch_features].
Optional int grid of shape [images, 3] holding each image’s (t, h, w) patch counts.
Optional flattened video patches of shape [patches, patch_features].
Optional int grid of shape [videos, 3] holding each video’s (t, h, w) patch counts.
Optional bool mask of shape [batch, sequence], true at media tokens.
Backend metadata. Packed input sets qkv_format="thd" and passes cu_seqlens and
cu_seqlens_padded of shape [1, documents + 1], padded with -1000, and max_seqlen.
Returns: BaseModelOutputWithPast
Output whose last_hidden_state has shape [batch, sequence, hidden], or [1, tokens, hidden] for
Bases: PreTrainedModel
Hugging Face-compatible base class for native MuseGlimmer.
Bases: Module
RMSNorm whose checkpoint weight stores an offset from one.
Bases: Module
MuseGlimmer split-half rotary embedding matching the canonical HF implementation.
Bases: Module
Parameter-free RMSNorm used for embedding and Q/K normalization.
Align full or already-sharded position IDs with model-owned CP embeddings.
Apply split-half RoPE to native BSHD or THD tensors.
Repeat B,Hkv,S,D keys/values to query-head count.