Spaces:
Running
Running
| """Starter utilities for future LoRA fine-tuning.""" | |
| from __future__ import annotations | |
| from peft import LoraConfig, get_peft_model | |
| def attach_lora(model): | |
| """Attach a default LoRA adapter to a loaded model.""" | |
| config = LoraConfig( | |
| r=16, | |
| lora_alpha=32, | |
| target_modules=["q_proj", "k_proj", "v_proj", "o_proj"], | |
| lora_dropout=0.05, | |
| bias="none", | |
| task_type="CAUSAL_LM", | |
| ) | |
| return get_peft_model(model, config) | |