Skip to content

Commit b82e6a3

Browse files
jeejeeleeAlvant
authored andcommitted
[LoRA] Relax LoRA condition (vllm-project#7146)
Signed-off-by: Alvant <[email protected]>
1 parent 3368e1c commit b82e6a3

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

tests/lora/test_layers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ def create_random_embedding_layer():
420420
@torch.inference_mode()
421421
@pytest.mark.parametrize("num_loras", [1, 2, 4, 8])
422422
@pytest.mark.parametrize("device", CUDA_DEVICES)
423-
@pytest.mark.parametrize("vocab_size", [512, 32000, 64000, 128000])
423+
@pytest.mark.parametrize("vocab_size", [512, 32000, 64000, 256512])
424424
@pytest.mark.parametrize("stage", STAGES)
425425
def test_lm_head_logits_processor(dist_init, num_loras, device, vocab_size,
426426
stage) -> None:

tests/lora/test_punica_variation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
BATCHES = [1, 4, 16, 32]
2626
NUM_LORA = [1, 4, 8, 16, 32, 64, 128]
2727
DTYPES = [torch.float16, torch.bfloat16]
28-
MAX_RANKS = [1, 4, 8, 16, 32, 64, 128]
28+
MAX_RANKS = [1, 4, 8, 16, 32, 64, 128, 256]
2929
SCALES = [0.5]
3030
SEED = [0]
3131
CUDA_DEVICES = [f"cuda:{0}"]

vllm/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,8 +1311,9 @@ class LoRAConfig:
13111311
long_lora_scaling_factors: Optional[Tuple[float]] = None
13121312

13131313
def __post_init__(self):
1314-
# TODO: Increase the range of rank
1315-
possible_max_ranks = (8, 16, 32, 64)
1314+
# Setting the maximum rank to 256 should be able to satisfy the vast
1315+
# majority of applications.
1316+
possible_max_ranks = (8, 16, 32, 64, 128, 256)
13161317
possible_lora_extra_vocab_size = (0, 256, 512)
13171318
if self.max_lora_rank not in possible_max_ranks:
13181319
raise ValueError(

vllm/lora/layers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,10 +1073,10 @@ def create_lora_weights(
10731073
lora_config: LoRAConfig,
10741074
model_config: Optional[PretrainedConfig] = None,
10751075
) -> None:
1076-
# TODO: Verify if this condition can be relaxed
1077-
if 32000 < self.base_layer.vocab_size > 128512:
1076+
# TODO: Verify if this condition can be further relaxed
1077+
if 32000 < self.base_layer.vocab_size > 257024:
10781078
raise ValueError("When using LoRA, vocab size must be "
1079-
"32000 >= vocab_size <= 128512")
1079+
"32000 >= vocab_size <= 257024")
10801080
self.lora_a_stacked = torch.zeros(
10811081
(
10821082
max_loras,

0 commit comments

Comments
 (0)