u-10bei/structured_data_with_cot_dataset_512_v2
Viewer • Updated • 3.93k • 60 • 1
How to use GawinGowin/dpo-struct-output-sfted with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="GawinGowin/dpo-struct-output-sfted") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("GawinGowin/dpo-struct-output-sfted")
model = AutoModelForCausalLM.from_pretrained("GawinGowin/dpo-struct-output-sfted", device_map="auto")How to use GawinGowin/dpo-struct-output-sfted with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "GawinGowin/dpo-struct-output-sfted"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "GawinGowin/dpo-struct-output-sfted",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/GawinGowin/dpo-struct-output-sfted
How to use GawinGowin/dpo-struct-output-sfted with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "GawinGowin/dpo-struct-output-sfted" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "GawinGowin/dpo-struct-output-sfted",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "GawinGowin/dpo-struct-output-sfted" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "GawinGowin/dpo-struct-output-sfted",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use GawinGowin/dpo-struct-output-sfted with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for GawinGowin/dpo-struct-output-sfted to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for GawinGowin/dpo-struct-output-sfted to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for GawinGowin/dpo-struct-output-sfted to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="GawinGowin/dpo-struct-output-sfted",
max_seq_length=2048,
)How to use GawinGowin/dpo-struct-output-sfted with Docker Model Runner:
docker model run hf.co/GawinGowin/dpo-struct-output-sfted
This model is a full-merged 16-bit version of Qwen/Qwen3-4B-Instruct-2507 with a Supervised Fine-Tuning (SFT) LoRA adapter merged into the base weights.
It serves as the base model for subsequent DPO training.
Qwen/Qwen3-4B-Instruct-2507 (base)
|
v
SFT via QLoRA (4-bit, Unsloth)
- Objective: structured output accuracy (JSON / YAML / XML / TOML / CSV)
- Adapter: GawinGowin/lora-struct-output (private)
|
v
Merge adapter into full weights -> this model
|
v
DPO -> GawinGowin/dpo-struct-output-sfted
| Parameter | Value |
|---|---|
| Base model | Qwen/Qwen3-4B-Instruct-2507 |
| Method | QLoRA (4-bit) + Unsloth |
| Training objective | Structured output (JSON / YAML / XML / TOML / CSV) |
| Dataset | u-10bei/structured_data_with_cot_dataset_512_v2 |
| Max sequence length | 512 |
| Epochs | 1 |
| Learning rate | 1e-6 |
| LoRA r / alpha | 64 / 128 |
| CoT Masking | Enabled (loss applied after Output: marker only) |
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Use the DPO model for inference
model_id = "GawinGowin/dpo-struct-output-sfted"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id, torch_dtype=torch.float16, device_map="auto",
)
Base model
Qwen/Qwen3-4B-Instruct-2507