coding-llm-space / src /lora_prepare.py
girish00's picture
Upload folder using huggingface_hub
07a91a1 verified
raw
history blame contribute delete
490 Bytes
"""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)