1
- from dataclasses import dataclass
1
+ import warnings
2
+ from dataclasses import dataclass , field
2
3
from typing import Optional
3
4
4
5
from vllm .adapter_commons .request import AdapterRequest
@@ -20,10 +21,25 @@ class LoRARequest(AdapterRequest):
20
21
21
22
lora_name : str
22
23
lora_int_id : int
23
- lora_path : str
24
+ lora_path : str = ""
25
+ lora_local_path : Optional [str ] = field (default = None , repr = False )
24
26
long_lora_max_len : Optional [int ] = None
25
27
__hash__ = AdapterRequest .__hash__
26
28
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
+
27
43
@property
28
44
def adapter_id (self ):
29
45
return self .lora_int_id
@@ -32,6 +48,26 @@ def adapter_id(self):
32
48
def name (self ):
33
49
return self .lora_name
34
50
51
+ @property
52
+ def path (self ):
53
+ return self .lora_path
54
+
35
55
@property
36
56
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