Skip to content

Apply deepseek cuda rope #5385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 14, 2025
Merged
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
13 changes: 12 additions & 1 deletion python/sglang/srt/layers/rotary_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,18 @@ def _compute_cos_sin_cache(self) -> torch.Tensor:
cache = torch.cat((cos, sin), dim=-1)
return cache

def forward(
def forward_hip(self, *args, **kwargs):
return self.forward_native(*args, **kwargs)

def forward(self, *args, **kwargs):
if torch._dynamo.is_compiling:
return self.forward_native(*args, **kwargs)
if _is_cuda_available:
return self.forward_cuda(*args, **kwargs)
else:
return self.forward_native(*args, **kwargs)

def forward_native(
self,
positions: torch.Tensor,
query: torch.Tensor,
Expand Down
Loading