request.py 934 Bytes
Newer Older
1
from dataclasses import dataclass
2
from typing import Optional
3

4
5
from vllm.adapter_commons.request import AdapterRequest

6
7

@dataclass
8
class LoRARequest(AdapterRequest):
9
10
11
    """
    Request for a LoRA adapter.

12
    Note that this class should be used internally. For online
13
14
15
16
17
18
19
20
21
22
23
    serving, it is recommended to not allow users to use this class but
    instead provide another layer of abstraction to prevent users from
    accessing unauthorized LoRA adapters.

    lora_int_id must be globally unique for a given adapter.
    This is currently not enforced in vLLM.
    """

    lora_name: str
    lora_int_id: int
    lora_local_path: str
24
    long_lora_max_len: Optional[int] = None
25
    __hash__ = AdapterRequest.__hash__
26

27
28
29
    @property
    def adapter_id(self):
        return self.lora_int_id
30

31
32
33
    @property
    def name(self):
        return self.lora_name
34

35
36
37
    @property
    def local_path(self):
        return self.lora_local_path