Downloads · 30 days
0
RinnRinnmini/qwen3-4b-structeval-sftdpo_v2-adapter
qwen3-4b-structeval-sftdpo_v2-adapter is a text generation model from RinnRinnmini. 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 (PEFT) for StructEval-T style structured output tasks. It is trained as SFT → DPO on top of Qwen/Qwen3-4B-Instruct-2507.
Downloads · 30 days
0
Access
Public
Updated Feb 6, 2026
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 contains a LoRA adapter (PEFT) for StructEval-T style structured output tasks.
It is trained as SFT → DPO on top of Qwen/Qwen3-4B-Instruct-2507.
⚠️ This repo is NOT a full merged model.
Load the base model first, then apply this adapter.
u-10bei/dpo-dataset-qwen-cotRinnRinnmini/lora_structeval_t_qwen3_4b_sft_v1
(This adapter was used as initialization before DPO.)Qwen/Qwen3-4B-Instruct-2507RinnRinnmini/lora_structeval_t_qwen3_4b_sft_v1 as the initialization pointDPOTrainerfrom transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
BASE_ID = "Qwen/Qwen3-4B-Instruct-2507"
# BASE_ID = "unsloth/Qwen3-4B-Instruct-2507"
ADAPTER_ID = "RinnRinnmini/qwen3-4b-structeval-sftdpo_v2-adapter" # this repo (LoRA adapter)
tok = AutoTokenizer.from_pretrained(BASE_ID, trust_remote_code=True, use_fast=True)
if tok.pad_token is None:
tok.pad_token = tok.eos_token
base = AutoModelForCausalLM.from_pretrained(
BASE_ID,
device_map="auto",
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
trust_remote_code=True,
)
model = PeftModel.from_pretrained(base, ADAPTER_ID)
model.eval()
messages = [
{"role": "user", "content": "Return a JSON with keys a,b,c and integer values."}
]
prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tok(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
out = model.generate(
**inputs,
max_new_tokens=256,
do_sample=False,
pad_token_id=tok.eos_token_id,
)
print(tok.decode(out[0], skip_special_tokens=True))