nemo_automodel.components.models.ergo.rope
nemo_automodel.components.models.ergo.rope
Source-equivalent CPU RoPE tables with a model-owned device cache.
The arithmetic contract is documented in layers.py’s release provenance. DeepSeek’s shared helpers allow default-device construction and fused rotation; Ergo requires CPU FP32 table construction and its existing complex rotation.
Module Contents
Classes
API
Bases: Module
Share one derived table across attention layers, outside checkpoint state.
These caches deliberately are not buffers: Module.to(dtype) would cast complex buffers to real values, and to_empty would destroy their contents. The CPU master remains complex64; module transforms invalidate only the device copy. Construction is lazy so meta initialization allocates no frequency table.
Select CPU-rounded complex64 frequencies on the positions’ device.
Parameters:
Integer IDs [batch, sequence] or packed [tokens], in [0, max_position_embeddings). Resets and repeated IDs are valid.
Returns: torch.Tensor
Complex64 frequencies [batch, sequence, head_dim / 2] or