request.py 931 B

12345678910111213141516171819202122232425262728293031323334353637
  1. from dataclasses import dataclass
  2. from typing import Optional
  3. from aphrodite.adapter_commons.request import AdapterRequest
  4. @dataclass
  5. class LoRARequest:
  6. """
  7. Request for a LoRA adapter.
  8. Note that this class should be be used internally. For online
  9. serving, it is recommended to not allow users to use this class but
  10. instead provide another layer of abstraction to prevent users from
  11. accessing unauthorized LoRA adapters.
  12. lora_int_id must be globally unique for a given adapter.
  13. This is currently not enforced in Aphrodite.
  14. """
  15. lora_name: str
  16. lora_int_id: int
  17. lora_local_path: str
  18. long_lora_max_len: Optional[int] = None
  19. __hash__ = AdapterRequest.__hash__
  20. @property
  21. def adapter_id(self):
  22. return self.lora_int_id
  23. @property
  24. def name(self):
  25. return self.lora_name
  26. @property
  27. def local_path(self):
  28. return self.lora_local_path