Downloads · 30 days
8
12% of all-time downloads
AREEBAFATIMA12/SmolLM-135M-SFT-DPO
SmolLM-135M-SFT-DPO is a machine learning model from AREEBAFATIMA12. 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. The card lists the license as apache-2.0.
A fine-tuned version of SmolLM-135M for instruction following, trained using Supervised Fine-Tuning (SFT) followed by Direct Preference Optimization (DPO) with LoRA adapters.
Downloads · 30 days
8
12% of all-time downloads
All-time downloads
68
Public
Parameters
135M
577 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors577 MB · 99%
From the Hugging Face model README
A fine-tuned version of SmolLM-135M for instruction following, trained using Supervised Fine-Tuning (SFT) followed by Direct Preference Optimization (DPO) with LoRA adapters.
| Stage | Avg BLEU | Corpus BLEU | Avg BERTScore |
|---|---|---|---|
| Base (no tuning) | 0.1043 | 0.0864 | 0.7957 |
| Best SFT (Trial 3) | 0.1513 | 0.1112 | 0.8210 |
| Best DPO | 0.0264 | 0.0148 | 0.7221 |
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
base = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/SmolLM-135M")
tokenizer = AutoTokenizer.from_pretrained("AREEBAFATIMA12/SmolLM-135M-SFT-DPO")
model = PeftModel.from_pretrained(base, "AREEBAFATIMA12/SmolLM-135M-SFT-DPO")
model.eval()
prompt = "<|user|>\nWhat causes seasons on Earth?</s>\n<|assistant|>\n"
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
out = model.generate(**inputs, max_new_tokens=150, do_sample=False,
pad_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))