nemo_automodel.components.models.gpt_oss.layers
nemo_automodel.components.models.gpt_oss.layers
Module Contents
Classes
Functions
API
Bases: Module
Attend with the configured backend and the original learned sink parameter.
Parameters:
Hidden states [batch, sequence, hidden] or [physical_tokens, hidden].
Non-fused cosine/sine tensor [batch, sequence, rotary_dim] or [physical_tokens, rotary_dim]; fused angles have shape [sequence, 1, 1, rotary_dim]. rotary_dim is even and at most head_dim.
Optional BSHD padding mask [batch, sequence].
Logical/physical offsets [documents + 1] and optional private compact FA4 indices [valid_tokens], prepared at model entry.
Returns: torch.Tensor
Projected states with the same layout as x. Physical padding remains present.
Restrict physical THD dispatch to the measured SM100 kernel geometry.
Parameters:
Query tensor of shape [physical_tokens, heads, head_dim].
Key tensor of shape [physical_tokens, kv_heads, head_dim].
Value tensor of shape [physical_tokens, kv_heads, head_dim].
Prepared metadata: _fa4_seqused is int32 [documents],
_fa4_physical_cu_seqlens is int32 [documents + 1],
packed_token_indices is int64 [valid_tokens], and
learnable_sink is BF16 [heads]. No input is mutated.
Returns: bool
Whether the shape, dtype, device, window and prefix metadata fall in