Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def __init__(
beta_slow: int = 1,
mscale: float = 1,
mscale_all_dim: float = 0,
init_cache: bool = True,
) -> None:
self.scaling_factor = scaling_factor
self.extrapolation_factor = extrapolation_factor
Expand All @@ -65,7 +66,13 @@ def __init__(
and head_size in [64, 128, 256, 512]
)
super().__init__(
head_size, rotary_dim, max_position_embeddings, base, is_neox_style, dtype
head_size,
rotary_dim,
max_position_embeddings,
base,
is_neox_style,
dtype,
init_cache=init_cache,
)

def _compute_inv_freq(self, scaling_factor: float) -> torch.Tensor:
Expand Down Expand Up @@ -211,7 +218,9 @@ class DeepseekV4ScalingRotaryEmbedding(DeepseekScalingRotaryEmbedding):
"""

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Avoid compute cache repeatedly
kwargs.pop("init_cache", None)
super().__init__(*args, **kwargs, init_cache=False)
cache_fp32 = self._compute_cos_sin_cache()
self.register_buffer("cos_sin_cache", cache_fp32, persistent=False)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we delete this? Seems already registered in RotaryEmbeddingBase


Expand Down
1 change: 0 additions & 1 deletion vllm/model_executor/models/deepseek_v4.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,6 @@ def __init__(
max_position=self.max_position_embeddings,
rope_parameters=rope_parameters,
is_neox_style=False,
dtype=config.torch_dtype,
)

self.indexer = None
Expand Down
Loading