nemo_automodel.components.models.mistral_large4.rope_utils
nemo_automodel.components.models.mistral_large4.rope_utils
Mistral Large 4 differentiable rotary and SSMax floating-point numerics.
Module Contents
Classes
Functions
API
Bases: LayerNorm
Normalize indexer keys with an FP32 parameter-owning module call.
Normalize in FP32 and restore the input activation dtype.
Parameters:
Tensor of shape […, index_dim], with arbitrary leading dimensions.
Returns: torch.Tensor
Independent tensor with the input shape/dtype. Parameters remain FP32.
Bases: Module
Shared learnable LeRoPE frequencies; build angles in FP32 after dtype casts.
Build differentiable interleaved YaRN tables.
Parameters:
Integer tensor of shape [tokens] containing document-relative positions.
Returns: torch.Tensor
FP32 cosine and sine tensors, each of shape [tokens, rotary_dim / 2].
Bases: Module
Per-head s * log(position + 1) + b in the query’s compute dtype.
Scale a query without modifying storage shared with another consumer.
Parameters:
Tensor of shape [tokens, heads, head_dim].
FP32 tensor of shape [tokens].
Returns: torch.Tensor
Independent tensor of shape [tokens, heads, head_dim] in q.dtype.
Rotate adjacent channel pairs in FP32, then restore the activation dtype.
Parameters:
Tensor of shape [tokens, heads, rotary_dim] or [tokens, rotary_dim].
FP32 cosine and sine tensors of shape [tokens, rotary_dim / 2].
Returns: torch.Tensor
Independent tensor with the same shape and dtype as x.