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
6d93d353
Unverified
Commit
6d93d353
authored
Mar 25, 2024
by
Kunshang Ji
Committed by
GitHub
Mar 24, 2024
Browse files
[BugFix] tensor.get_device() -> tensor.device (#3604)
parent
837e1851
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
vllm/model_executor/layers/rotary_embedding.py
vllm/model_executor/layers/rotary_embedding.py
+2
-2
No files found.
vllm/model_executor/layers/rotary_embedding.py
View file @
6d93d353
...
...
@@ -108,7 +108,7 @@ class RotaryEmbedding(nn.Module):
query_pass
=
query
[...,
self
.
rotary_dim
:]
key_pass
=
key
[...,
self
.
rotary_dim
:]
self
.
cos_sin_cache
=
self
.
cos_sin_cache
.
to
(
positions
.
get_
device
()
)
self
.
cos_sin_cache
=
self
.
cos_sin_cache
.
to
(
positions
.
device
)
cos_sin
=
self
.
cos_sin_cache
[
torch
.
add
(
positions
,
offsets
)
if
offsets
is
not
None
else
positions
]
cos
,
sin
=
cos_sin
.
chunk
(
2
,
dim
=-
1
)
...
...
@@ -142,7 +142,7 @@ class RotaryEmbedding(nn.Module):
key
:
torch
.
Tensor
,
offsets
:
Optional
[
torch
.
Tensor
]
=
None
,
)
->
Tuple
[
torch
.
Tensor
,
torch
.
Tensor
]:
self
.
cos_sin_cache
=
self
.
cos_sin_cache
.
to
(
positions
.
get_
device
()
)
self
.
cos_sin_cache
=
self
.
cos_sin_cache
.
to
(
positions
.
device
)
# ops.rotary_embedding()/batched_rotary_embedding()
# are in-place operations that update the query and key tensors.
if
offsets
is
not
None
:
...
...
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