> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/automodel/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/automodel/_mcp/server.

# nemo_automodel.components.models.ling_v2.layers

Attention layer for BailingMoeV2 (Ling 2.0).

GQA + per-head QK-RMSNorm + partial RoPE.  Equivalent to Qwen3-MoE attention
with an additional `partial_rotary_factor` knob that rotates only the first
`head_dim * partial_rotary_factor` channels and passes the rest through
(GPT-J / GPT-NeoX half-RoPE).

## Module Contents

### Classes

| Name                                                                                              | Description                     |
| ------------------------------------------------------------------------------------------------- | ------------------------------- |
| [`BailingMoeV2Attention`](#nemo_automodel-components-models-ling_v2-layers-BailingMoeV2Attention) | Bailing MoE V2 attention block. |

### API

```python
class nemo_automodel.components.models.ling_v2.layers.BailingMoeV2Attention(
    config,
    backend: nemo_automodel.components.models.common.BackendConfig
)
```

**Bases:** `Module`

Bailing MoE V2 attention block.

```python
nemo_automodel.components.models.ling_v2.layers.BailingMoeV2Attention.forward(
    x: torch.Tensor,
    freqs_cis: torch.Tensor,
    attention_mask: torch.Tensor | None = None,
    attn_kwargs: typing.Any = {}
) -> torch.Tensor
```

```python
nemo_automodel.components.models.ling_v2.layers.BailingMoeV2Attention.init_weights(
    buffer_device: torch.device,
    init_std: float = 0.02
) -> None
```