Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
ece5a8b0
Unverified
Commit
ece5a8b0
authored
Apr 30, 2025
by
Lu Fang
Committed by
GitHub
Apr 30, 2025
Browse files
Make the _apply_rotary_emb compatible with dynamo (#17435)
parent
54072f31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
vllm/model_executor/layers/rotary_embedding.py
vllm/model_executor/layers/rotary_embedding.py
+3
-1
No files found.
vllm/model_executor/layers/rotary_embedding.py
View file @
ece5a8b0
...
@@ -32,6 +32,9 @@ from transformers import PretrainedConfig
...
@@ -32,6 +32,9 @@ from transformers import PretrainedConfig
from
vllm.model_executor.custom_op
import
CustomOp
from
vllm.model_executor.custom_op
import
CustomOp
from
vllm.platforms
import
current_platform
from
vllm.platforms
import
current_platform
if
current_platform
.
is_cuda_alike
():
from
vllm.vllm_flash_attn.layers.rotary
import
apply_rotary_emb
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
]
...
@@ -78,7 +81,6 @@ def _apply_rotary_emb(x: torch.Tensor, cos: torch.Tensor, sin: torch.Tensor,
...
@@ -78,7 +81,6 @@ def _apply_rotary_emb(x: torch.Tensor, cos: torch.Tensor, sin: torch.Tensor,
positional embeddings.
positional embeddings.
"""
"""
if
current_platform
.
is_cuda_alike
():
if
current_platform
.
is_cuda_alike
():
from
vllm.vllm_flash_attn.layers.rotary
import
apply_rotary_emb
return
apply_rotary_emb
(
x
.
unsqueeze
(
0
),
cos
,
sin
,
return
apply_rotary_emb
(
x
.
unsqueeze
(
0
),
cos
,
sin
,
not
is_neox_style
).
squeeze
(
0
)
not
is_neox_style
).
squeeze
(
0
)
else
:
else
:
...
...
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