Unverified Commit 33288ff1 authored by Marc Sun's avatar Marc Sun Committed by GitHub
Browse files

[bnb] Fix bug in `_replace_with_bnb_linear` (#29958)

fix bug
parent 416711c3
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment