File size: 490 Bytes
07a91a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""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)