Load Single adapter from adapter_path. Expect adapter_config.json and LoRA adapter weights at this path within subdirectory `/0/items`.
(self, adapter_path)
| 283 | return params |
| 284 | |
| 285 | def load_single_adapter(self, adapter_path): |
| 286 | """ |
| 287 | Load Single adapter from adapter_path. |
| 288 | Expect adapter_config.json and LoRA adapter weights at this path within subdirectory `/0/items`. |
| 289 | """ |
| 290 | adapter_config_path = os.path.join(adapter_path, "adapter_config.json") |
| 291 | adapter_weights_path = os.path.join(adapter_path, "0", "items") |
| 292 | |
| 293 | params, config = lora_utils.load_adapter(self.config, self.abstract_params, adapter_config_path, adapter_weights_path) |
| 294 | |
| 295 | if config is None: |
| 296 | raise ValueError(f"Failed to read lora_config from {adapter_config_path}") |
| 297 | |
| 298 | if params is None: |
| 299 | raise ValueError(f"Failed to read lora_config from {adapter_config_path}") |
| 300 | |
| 301 | config["adapter_path"] = adapter_weights_path |
| 302 | |
| 303 | self.print_stats("After load_single_adapter.") |
| 304 | |
| 305 | return params, config |
| 306 | |
| 307 | def apply_adapter(self, base_params, adapter_config, adapter_params): |
| 308 | """Apply the adapter params on the base params.""" |
nothing calls this directly
no test coverage detected