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
OpenDAS
AutoAWQ
Commits
841a2313
Commit
841a2313
authored
Sep 27, 2023
by
s4rduk4r
Browse files
Fix apply_rotary_emb() to have both tensors on the same device
parent
ffaaa259
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
awq/modules/fused/attn.py
awq/modules/fused/attn.py
+1
-1
No files found.
awq/modules/fused/attn.py
View file @
841a2313
...
@@ -36,7 +36,7 @@ def apply_rotary_emb(
...
@@ -36,7 +36,7 @@ def apply_rotary_emb(
xk_
=
torch
.
view_as_complex
(
xk_
=
torch
.
view_as_complex
(
xk
.
float
().
reshape
(
*
xk
.
shape
[:
-
1
],
2
,
-
1
).
transpose
(
-
2
,
-
1
).
contiguous
()
xk
.
float
().
reshape
(
*
xk
.
shape
[:
-
1
],
2
,
-
1
).
transpose
(
-
2
,
-
1
).
contiguous
()
)
)
freqs_cis
=
reshape_for_broadcast
(
freqs_cis
,
xq_
)
freqs_cis
=
reshape_for_broadcast
(
freqs_cis
,
xq_
)
.
to
(
xq_
.
device
)
xq_out
=
torch
.
view_as_real
(
xq_
*
freqs_cis
).
transpose
(
-
2
,
-
1
).
flatten
(
3
)
xq_out
=
torch
.
view_as_real
(
xq_
*
freqs_cis
).
transpose
(
-
2
,
-
1
).
flatten
(
3
)
xk_out
=
torch
.
view_as_real
(
xk_
*
freqs_cis
).
transpose
(
-
2
,
-
1
).
flatten
(
3
)
xk_out
=
torch
.
view_as_real
(
xk_
*
freqs_cis
).
transpose
(
-
2
,
-
1
).
flatten
(
3
)
return
xq_out
.
type_as
(
xq
),
xk_out
.
type_as
(
xk
)
return
xq_out
.
type_as
(
xq
),
xk_out
.
type_as
(
xk
)
...
...
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