Request for a LoRA adapter.
| 23 | |
| 24 | @dataclass(slots=True) |
| 25 | class LoRARequest: |
| 26 | """ Request for a LoRA adapter. """ |
| 27 | lora_name: str |
| 28 | lora_int_id: int |
| 29 | lora_path: str = "" |
| 30 | lora_ckpt_source: str = "hf" |
| 31 | |
| 32 | def __post_init__(self): |
| 33 | if self.lora_path is not None and not os.path.exists(self.lora_path): |
| 34 | raise ValueError(f"lora_path ({self.lora_path}) does not exist.") |
| 35 | if self.lora_ckpt_source not in ["hf", "nemo"]: |
| 36 | raise ValueError( |
| 37 | f"lora_ckpt_source must be 'hf' or 'nemo', got '{self.lora_ckpt_source}'" |
| 38 | ) |
| 39 | |
| 40 | @property |
| 41 | def adapter_id(self): |
| 42 | return self.lora_int_id |
| 43 | |
| 44 | @property |
| 45 | def name(self): |
| 46 | return self.lora_name |
| 47 | |
| 48 | @property |
| 49 | def path(self): |
| 50 | return self.lora_path |
| 51 | |
| 52 | @property |
| 53 | def ckpt_source(self): |
| 54 | return self.lora_ckpt_source |
| 55 | |
| 56 | |
| 57 | @dataclass(slots=True) |
no outgoing calls