nemo_automodel.components.models.gpt_oss.layers

View as Markdown

Module Contents

Classes

NameDescription
GptOssAttention-

API

class nemo_automodel.components.models.gpt_oss.layers.GptOssAttention(
config: transformers.models.gpt_oss.configuration_gpt_oss.GptOssConfig,
backend: nemo_automodel.components.models.common.BackendConfig,
use_sliding_attention: bool = False
)

Bases: Module

head_dim
= config.head_dim
hidden_size
= config.hidden_size
k_proj
num_attention_heads
= config.num_attention_heads
num_key_value_heads
= config.num_key_value_heads
o_proj
q_proj
sinks
sliding_window
softmax_scale
= self.head_dim ** -0.5
v_proj
yarn_concentration
= yarn_get_mscale(config.rope_scaling['factor'])
nemo_automodel.components.models.gpt_oss.layers.GptOssAttention.forward(
x: torch.Tensor,
freqs_cis: torch.Tensor,
attention_mask: torch.Tensor | None = None,
attn_kwargs: typing.Any = {}
) -> torch.Tensor
nemo_automodel.components.models.gpt_oss.layers.GptOssAttention.init_weights(
buffer_device: torch.device,
init_std: float = 0.02
)