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
chenpangpang
transformers
Commits
33288ff1
Unverified
Commit
33288ff1
authored
Apr 02, 2024
by
Marc Sun
Committed by
GitHub
Apr 02, 2024
Browse files
[bnb] Fix bug in `_replace_with_bnb_linear` (#29958)
fix bug
parent
416711c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
src/transformers/integrations/bitsandbytes.py
src/transformers/integrations/bitsandbytes.py
+4
-1
No files found.
src/transformers/integrations/bitsandbytes.py
View file @
33288ff1
...
...
@@ -156,7 +156,10 @@ def _replace_with_bnb_linear(
if
(
isinstance
(
module
,
nn
.
Linear
)
or
isinstance
(
module
,
Conv1D
))
and
name
not
in
modules_to_not_convert
:
# Check if the current key is not in the `modules_to_not_convert`
if
not
any
(
key
in
"."
.
join
(
current_key_name
)
for
key
in
modules_to_not_convert
):
current_key_name_str
=
"."
.
join
(
current_key_name
)
if
not
any
(
(
key
+
"."
in
current_key_name_str
)
or
(
key
==
current_key_name_str
)
for
key
in
modules_to_not_convert
):
with
init_empty_weights
():
if
isinstance
(
module
,
Conv1D
):
in_features
,
out_features
=
module
.
weight
.
shape
...
...
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