Skip to content

vllm.model_executor.layers.rotary_embedding.deepseek_scaling_rope

Classes:

DeepseekScalingRotaryEmbedding

Bases: RotaryEmbeddingBase

RotaryEmbedding extended with YaRN method.

Credits to Peng et al. github.com/jquesnelle/yarn

Methods:

forward_native(positions, query, key=None, offsets=None)

PyTorch-native implementation equivalent to forward().

forward_static(positions, query, key, head_size, rotary_dim, cos_sin_cache, is_neox_style, offsets=None) staticmethod

A static implementation of forward().

DeepseekV4ScalingRotaryEmbedding

Bases: DeepseekScalingRotaryEmbedding

RotaryEmbedding extended with YaRN method.

Credits to Peng et al. github.com/jquesnelle/yarn

Compared to DeepseekScalingRotaryEmbedding: - Applies RoPE to the last rotary_dim - The forward method requires an inverse parameter to indicate whether to negate the sin - Supports applying RoPE to query only (without key) - cos_sin_cache stored as fp32 for higher precision RoPE

Methods:

  • forward_native –

    PyTorch-native implementation equivalent to forward().

forward_native(positions, query, key=None, offsets=None, inverse=False)

PyTorch-native implementation equivalent to forward().