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
2c05f81f
Unverified
Commit
2c05f81f
authored
Jan 20, 2025
by
Yineng Zhang
Committed by
GitHub
Jan 20, 2025
Browse files
fix custom op version compatibility (#2988)
parent
d77caa2b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
python/pyproject.toml
python/pyproject.toml
+1
-1
python/sglang/srt/layers/rotary_embedding.py
python/sglang/srt/layers/rotary_embedding.py
+3
-1
No files found.
python/pyproject.toml
View file @
2c05f81f
...
@@ -27,7 +27,7 @@ runtime_common = [
...
@@ -27,7 +27,7 @@ runtime_common = [
]
]
srt
=
[
srt
=
[
"sglang[runtime_common]"
,
"cuda-python"
,
"sglang[runtime_common]"
,
"cuda-python"
,
"sgl-kernel>=0.0.2.post14"
,
"torch"
,
"vllm
>=0.6.3.post1,<
=0.6.4.post1"
,
"sgl-kernel>=0.0.2.post14"
,
"torch"
,
"vllm
=
=0.6.4.post1"
,
"flashinfer==0.1.6"
"flashinfer==0.1.6"
]
]
...
...
python/sglang/srt/layers/rotary_embedding.py
View file @
2c05f81f
...
@@ -8,6 +8,8 @@ import torch
...
@@ -8,6 +8,8 @@ import torch
import
torch.nn
as
nn
import
torch.nn
as
nn
from
vllm.model_executor.custom_op
import
CustomOp
from
vllm.model_executor.custom_op
import
CustomOp
from
sglang.srt.layers.custom_op_util
import
register_custom_op
def
_rotate_neox
(
x
:
torch
.
Tensor
)
->
torch
.
Tensor
:
def
_rotate_neox
(
x
:
torch
.
Tensor
)
->
torch
.
Tensor
:
x1
=
x
[...,
:
x
.
shape
[
-
1
]
//
2
]
x1
=
x
[...,
:
x
.
shape
[
-
1
]
//
2
]
...
@@ -51,7 +53,7 @@ def _apply_rotary_emb(
...
@@ -51,7 +53,7 @@ def _apply_rotary_emb(
return
torch
.
stack
((
o1
,
o2
),
dim
=-
1
).
flatten
(
-
2
)
return
torch
.
stack
((
o1
,
o2
),
dim
=-
1
).
flatten
(
-
2
)
@
CustomOp
.
register
(
"
rotary_embedding"
)
@
register_custom_op
(
"sglang_
rotary_embedding"
)
class
RotaryEmbedding
(
CustomOp
):
class
RotaryEmbedding
(
CustomOp
):
"""Original rotary positional embedding."""
"""Original rotary positional embedding."""
...
...
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