u-10bei/dpo-dataset-qwen-cot
Viewer • Updated • 4.04k • 19 • 2
How to use DLNorb/dpo_base_model_stage2 with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("unsloth/qwen3-4b-instruct-2507-unsloth-bnb-4bit")
model = PeftModel.from_pretrained(base_model, "DLNorb/dpo_base_model_stage2")This repository provides a DPO LoRA adapter fine-tuned directly from Qwen/Qwen3-4B-Instruct-2507 using QLoRA (4-bit, Unsloth).
Unlike the SFT+DPO pipeline, this adapter applies DPO directly to the base model without a prior SFT adapter.
This repository contains LoRA adapter weights only. The base model must be loaded separately.
This adapter applies Direct Preference Optimization (DPO) to improve structured output accuracy (JSON / YAML / XML / TOML / CSV) by aligning the model with human preferences.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
base = "Qwen/Qwen3-4B-Instruct-2507"
adapter = "DLNorb/dpo_base_model_stage2"
tokenizer = AutoTokenizer.from_pretrained(base)
model = AutoModelForCausalLM.from_pretrained(
base,
torch_dtype=torch.float16,
device_map="auto",
)
model = PeftModel.from_pretrained(model, adapter)
Training data:
Compliance: Users must comply with each dataset's license (including copyright notice) and the base model's original terms of use.
Base model
Qwen/Qwen3-4B-Instruct-2507