Views
No views yet
meta-llama/Llama-3.2-3B on the OpenHermes dataset.
The goal of this run was to adapt Llama-3.2-3B for improved instruction-following using a high-quality, multi-domain SFT dataset.meta-llama/Llama-3.2-3B
Method: QLoRA (LoRA rank 16, α=32, dropout=0.05)
Trainable Parameters: 24.3M / 3.24B (~0.75%)1training_args = TrainingArguments(
2 output_dir="./llama_finetune_lora",
3 per_device_train_batch_size=2,
4 gradient_accumulation_steps=8,
5 learning_rate=2e-4,
6 num_train_epochs=1,
7 lr_scheduler_type="cosine",
8 warmup_ratio=0.03,
9 weight_decay=0.01,
10 logging_steps=200,
11
12 evaluation_strategy="steps",
13 eval_steps=200,
14 save_strategy="steps",
15 save_steps=1000,
16 save_total_limit=2,
17 load_best_model_at_end=True,
18 metric_for_best_model="eval_loss",
19 greater_is_better=False,
20
21 bf16=True, # A100 support
22 fp16=False,
23 gradient_checkpointing=True,
24 torch_compile=False,
25 report_to="none",
26 seed=42
27)| Step | Training Loss | Validation Loss |
|---|---|---|
| 200 | 1.2781 | 0.2202 |
| 400 | 0.2167 | 0.2134 |
| 600 | 0.2139 | 0.2098 |
| 800 | 0.2120 | 0.2072 |
| 1000 | 0.2085 | 0.2057 |
| 1200 | 0.1996 | 0.2043 |
| 1400 | 0.2056 | 0.2034 |
| 1600 | 0.2016 | 0.2023 |
| 1800 | 0.2000 | 0.2012 |
| 2000 | 0.2027 | 0.2005 |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3
4base = "meta-llama/Llama-3.2-3B"
5adapter = "kunjcr2/llama3-3b-lora-openhermes" # replace with your Hub repo
6
7# Load base + adapter
8tok = AutoTokenizer.from_pretrained(adapter)
9model = AutoModelForCausalLM.from_pretrained(base, torch_dtype="auto", device_map="auto")
10model = PeftModel.from_pretrained(model, adapter)
11
12# Generate
13prompt = "Explain the concept of binary search trees."
14inputs = tok(prompt, return_tensors="pt").to(model.device)
15outputs = model.generate(**inputs, max_new_tokens=256)
16print(tok.decode(outputs[0], skip_special_tokens=True))adapter_model.safetensors, adapter_config.json, tokenizer files, and this README.