Skip to content

Commit 0ea0d0d

Browse files
committed
Add deprecation notice for lora_local_path
1 parent 10ee978 commit 0ea0d0d

File tree

2 files changed

+41
-8
lines changed

2 files changed

+41
-8
lines changed

tests/lora/conftest.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,20 +158,17 @@ def dummy_model_gate_up() -> nn.Module:
158158
return model
159159

160160

161-
@pytest.fixture(scope="session")
162-
def sql_lora_files():
163-
return snapshot_download(repo_id="yard1/llama-2-7b-sql-lora-test")
164-
165-
166161
@pytest.fixture(scope="session")
167162
def sql_lora_huggingface_id():
168163
# huggingface repo id is used to test lora runtime downloading.
169164
return "yard1/llama-2-7b-sql-lora-test"
170165

166+
171167
@pytest.fixture(scope="session")
172168
def sql_lora_files(sql_lora_huggingface_id):
173169
return snapshot_download(repo_id=sql_lora_huggingface_id)
174170

171+
175172
@pytest.fixture(scope="session")
176173
def mixtral_lora_files():
177174
# Note: this module has incorrect adapter_config.json to test

vllm/lora/request.py

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from dataclasses import dataclass
1+
import warnings
2+
from dataclasses import dataclass, field
23
from typing import Optional
34

45
from vllm.adapter_commons.request import AdapterRequest
@@ -20,10 +21,25 @@ class LoRARequest(AdapterRequest):
2021

2122
lora_name: str
2223
lora_int_id: int
23-
lora_path: str
24+
lora_path: str = ""
25+
lora_local_path: Optional[str] = field(default=None, repr=False)
2426
long_lora_max_len: Optional[int] = None
2527
__hash__ = AdapterRequest.__hash__
2628

29+
def __post_init__(self):
30+
if 'lora_local_path' in self.__dict__:
31+
warnings.warn(
32+
"The 'lora_local_path' attribute is deprecated "
33+
"and will be removed in a future version. "
34+
"Please use 'lora_path' instead.",
35+
DeprecationWarning,
36+
stacklevel=2)
37+
if not self.lora_path:
38+
self.lora_path = self.lora_local_path or ""
39+
40+
# Ensure lora_path is not empty
41+
assert self.lora_path, "lora_path can not be empty"
42+
2743
@property
2844
def adapter_id(self):
2945
return self.lora_int_id
@@ -32,6 +48,26 @@ def adapter_id(self):
3248
def name(self):
3349
return self.lora_name
3450

51+
@property
52+
def path(self):
53+
return self.lora_path
54+
3555
@property
3656
def local_path(self):
37-
return self.lora_local_path
57+
warnings.warn(
58+
"The 'local_path' attribute is deprecated "
59+
"and will be removed in a future version. "
60+
"Please use 'path' instead.",
61+
DeprecationWarning,
62+
stacklevel=2)
63+
return self.lora_path
64+
65+
@local_path.setter
66+
def local_path(self, value):
67+
warnings.warn(
68+
"The 'local_path' attribute is deprecated "
69+
"and will be removed in a future version. "
70+
"Please use 'path' instead.",
71+
DeprecationWarning,
72+
stacklevel=2)
73+
self.lora_path = value

0 commit comments

Comments
 (0)