Downloads · 30 days
8
3% of all-time downloads
WassyO/qwen3-4b-instruct-dpo-from-sft-4096
qwen3-4b-instruct-dpo-from-sft-4096 is a text generation model from WassyO. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
This repository provides a LoRA adapter trained with Direct Preference Optimization (DPO).
Downloads · 30 days
8
3% of all-time downloads
All-time downloads
289
Public
Repo size
540 MB
Likes
0
Public
Click a slice to open those files.
.safetensors529 MB · 97%
From the Hugging Face model README
This repository provides a LoRA adapter trained with Direct Preference Optimization (DPO).
Qwen/Qwen3-4B-Instruct-2507/content/lora_sft_bestu-10bei/dpo-dataset-qwen-cotThis repo contains LoRA adapter weights only. Load it on top of the base model.
Align responses with preferred outputs using DPO (pairwise preference learning).
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
base_id = "Qwen/Qwen3-4B-Instruct-2507"
lora_id = "WassyO/qwen3-4b-instruct-dpo-from-sft-4096"
tokenizer = AutoTokenizer.from_pretrained(base_id)
base = AutoModelForCausalLM.from_pretrained(
base_id,
torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float16,
device_map="auto",
)
model = PeftModel.from_pretrained(base, lora_id)
prompt = "Your question here"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))