nemo_automodel.components.models.qwen3_next.model
nemo_automodel.components.models.qwen3_next.model
Module Contents
Classes
Data
API
Bases: Module
Bases: HFCheckpointingMixin, Module, MoEFSDPSyncMixin
Run Qwen3Next without unsupported packed FA4 recurrent attention.
Parameters:
Token IDs of shape [batch, sequence].
Optional positions of shape [batch, sequence].
Padding/document IDs of shape [batch, sequence] or an explicit mask of shape [batch, 1, sequence, sequence].
Optional padding mask of shape [batch, sequence].
Number of trailing logits, or indices of shape [kept_tokens].
Whether to return the final hidden states.
Attention metadata, including cumulative document lengths of shape [documents + 1] and packed indices of shape [tokens].
Returns: CausalLMOutputWithPast
Model output with logits of shape [batch, kept_sequence, vocab] and
Raises:
ValueError: If packed FA4 is requested, since recurrent layers do not reset state at document boundaries.
Bases: Module
Run the decoder layers on padded or packed (THD) input.
Packed input arrives batched and is squeezed to [tokens, …] for the layers, which TE’s packed kernels take; the hidden states come back batched.
Parameters:
Token IDs of shape [batch, sequence], or packed token IDs of shape [1, tokens]. Later pipeline stages pass hidden states of shape [batch, sequence, hidden] or [1, tokens, hidden].
Optional positions of shape [batch, sequence]; packed input requires them, as [1, tokens].
Optional padding or attention mask for unpacked input; packed input ignores it.
Optional bool mask of shape [batch, sequence] or [1, tokens], true at padding.
Backend metadata. Packed input sets qkv_format="thd" and passes int32
cu_seqlens and cu_seqlens_padded of shape [1, documents + 1], padded with -1000, and
max_seqlen.
Returns: torch.Tensor
Hidden states of shape [batch, sequence, hidden], or [1, tokens, hidden] for packed input.