nemo_automodel.components.models.ernie4_5.rope_utils
nemo_automodel.components.models.ernie4_5.rope_utils
Module Contents
Classes
Functions
API
Bases: Module
Rotary embedding module matching the Hugging Face ERNIE 4.5 implementation.
attention_scaling
inv_freq
Apply ERNIE 4.5 interleaved rotary embeddings to q and k.
Parameters:
q
Query tensor in BSHD or THD format.
k
Key tensor in BSHD or THD format.
cos
Cosine tensor with shape [B, S, D] for BSHD or [T, D] for THD.
sin
Sine tensor with shape [B, S, D] for BSHD or [T, D] for THD.
Rotate interleaved RoPE pairs: [x0, x1] -> [-x1, x0].