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
c69d3b65
Unverified
Commit
c69d3b65
authored
Feb 14, 2024
by
Younes Belkada
Committed by
GitHub
Feb 14, 2024
Browse files
[`PEFT`] Fix PEFT batch size > 1 (#338)
parent
29ee66d9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
awq/modules/linear/gemm.py
awq/modules/linear/gemm.py
+4
-4
No files found.
awq/modules/linear/gemm.py
View file @
c69d3b65
...
...
@@ -89,10 +89,10 @@ class WQLinearMMFunction(Function):
)
if
ctx
.
needs_input_grad
[
0
]:
#
2
D mat
rix multiplication, unsqueeze to 3D
grad_input
=
grad_output
.
squeeze
(
0
).
mm
(
weights
.
transpose
(
0
,
1
)
).
unsqueeze
(
0
)
#
3
D mat
mul using torch.bmm: https://pytorch.org/docs/stable/generated/torch.bmm.html#torch.bmm
# to propagate gradient across all batch sizes.
batch_size
=
grad_output
.
shape
[
0
]
grad_input
=
grad_output
.
bmm
(
weights
.
transpose
(
0
,
1
).
unsqueeze
(
0
).
repeat
(
batch_size
,
1
,
1
)
)
return
grad_input
,
None
,
None
,
None
,
None
,
None
,
None
,
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