Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
fb6cc7b0
Unverified
Commit
fb6cc7b0
authored
Oct 21, 2025
by
zhangdonghao-zdh
Committed by
GitHub
Oct 21, 2025
Browse files
Fix RotaryEmbedding for fp32 input (#11843)
parent
8374a96e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
python/sglang/srt/layers/rotary_embedding.py
python/sglang/srt/layers/rotary_embedding.py
+6
-2
No files found.
python/sglang/srt/layers/rotary_embedding.py
View file @
fb6cc7b0
...
...
@@ -112,7 +112,7 @@ class RotaryEmbedding(CustomOp):
if
not
_is_cuda
:
cache
=
cache
.
to
(
dtype
)
if
(
if
dtype
==
torch
.
float32
or
(
(
not
(
_is_cuda
or
_is_npu
)
or
self
.
head_size
not
in
[
64
,
128
,
256
,
512
])
and
not
(
_is_cpu
and
_is_cpu_amx_available
)
and
not
_is_xpu
...
...
@@ -254,7 +254,11 @@ class RotaryEmbedding(CustomOp):
offsets
:
Optional
[
torch
.
Tensor
]
=
None
,
fused_set_kv_buffer_arg
:
Optional
[
FusedSetKVBufferArg
]
=
None
,
)
->
Tuple
[
torch
.
Tensor
,
torch
.
Tensor
]:
if
_is_cuda
and
(
self
.
head_size
in
[
64
,
128
,
256
,
512
]):
if
(
_is_cuda
and
(
self
.
head_size
in
[
64
,
128
,
256
,
512
])
and
self
.
dtype
!=
torch
.
float32
):
apply_rope_with_cos_sin_cache_inplace
(
positions
=
positions
,
query
=
query
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment