Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Adalora ranknum loaded on wrong device #1852

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/peft/tuners/adalora/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class AdaLoraLayer(LoraLayer):
# List all names of layers that may contain adapter weights
# Note: ranknum doesn't need to be included as it is not an nn.Module
adapter_layer_names = ("lora_A", "lora_B", "lora_E", "lora_embedding_A", "lora_embedding_B")
# other_param_names is defined in LoraLayer
# All names of other parameters that may contain adapter-related parameters
other_param_names = ("r", "lora_alpha", "scaling", "lora_dropout", "ranknum")

def __init__(self, base_layer: nn.Module) -> None:
super().__init__(base_layer)
Expand Down
1 change: 1 addition & 0 deletions tests/test_common_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,7 @@ def test_8bit_dora_merging(self):


@pytest.mark.skipif(not torch.cuda.is_available(), reason="test requires a CUDA GPU")
@pytest.mark.single_gpu_tests
class TestSameAdapterDifferentDevices:
# 1639
# The original issue comes down to the following problem: If the user has a base layer on CUDA, moves the adapter to
Expand Down
Loading