Downloads · 30 days
5
33% of all-time downloads
leesusan/tinyllama-dpo-lora
tinyllama-dpo-lora is a machine learning model from leesusan. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft.
This repository contains LoRA adapter weights fine-tuned using Direct Preference Optimization (DPO) on human preference data collected from a class-wide alignment project.
Downloads · 30 days
5
33% of all-time downloads
All-time downloads
15
Public
Repo size
5 MB
Likes
0
Public
Click a slice to open those files.
.safetensors4.5 MB · 52%
From the Hugging Face model README
This repository contains LoRA adapter weights fine-tuned using Direct Preference Optimization (DPO) on human preference data collected from a class-wide alignment project.
transformers, trl, peft, bitsandbytes| Setting | Value |
|---|---|
| Learning rate | 2e-4 |
| Batch size | 2 |
| Epochs | 2 |
text
text
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel
import torch
BASE = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
ADAPTER = "leesusan/tinyllama-dpo-lora"
bnb_cfg = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.float16,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
)
tok = AutoTokenizer.from_pretrained(BASE)
model = AutoModelForCausalLM.from_pretrained(BASE, quantization_config=bnb_cfg, device_map="auto")
model = PeftModel.from_pretrained(model, ADAPTER)
prompt = "Why do people experience jealousy in workplaces?"
inputs = tok(prompt, return_tensors="pt").to(model.device)
with torch.inference_mode():
out = model.generate(**inputs, max_new_tokens=150, temperature=0.7, top_p=0.9)
print(tok.decode(out[0], skip_special_tokens=True))
- **Repository:** [More Information Needed]
- **Paper [optional]:** [More Information Needed]
- **Demo [optional]:** [More Information Needed]