Downloads · 30 days
0
Hkumomo/qwen3-4b-structured-output-lora-dpo-v1
qwen3-4b-structured-output-lora-dpo-v1 is a text generation model from Hkumomo. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This repository contains a LoRA adapter fine-tuned with DPO for Qwen/Qwen3-4B-Instruct-2507 using the Unsloth library.
Downloads · 30 days
0
Access
Public
Updated Feb 23, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md1.9 KB · 55%
From the Hugging Face model README
This repository contains a LoRA adapter fine-tuned with DPO for Qwen/Qwen3-4B-Instruct-2507 using the Unsloth library.
This model has been optimized using DPO to align its responses with preferred outputs, focusing on improving reasoning (Chain-of-Thought) and structured response quality based on the provided preference dataset.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
base_model = "Qwen/Qwen3-4B-Instruct-2507"
adapter = "Hkumomo/qwen3-4b-structured-output-lora-dpo-v1"
tokenizer = AutoTokenizer.from_pretrained(base_model)
model = AutoModelForCausalLM.from_pretrained(
base_model,
torch_dtype=torch.float16,
device_map="auto"
)
model = PeftModel.from_pretrained(model, adapter)
# Test inference
prompt = "Your question here"
inputs = tokenizer.apply_chat_template([{"role": "user", "content": prompt}], tokenize=True, add_generation_prompt=True, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0]))