初始化项目,由ModelHub XC社区提供模型

Model: masachika/qwen3-4b-dpo-cot-merged
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-08-22 02:21:18 +08:00
commit b94bddf0e4
16 changed files with 152423 additions and 0 deletions

80
README.md Normal file
View File

@@ -0,0 +1,80 @@
---
base_model: Qwen/Qwen3-4B-Instruct-2507
datasets:
- u-10bei/dpo-dataset-qwen-cot
language:
- en
license: apache-2.0
library_name: transformers
pipeline_tag: text-generation
tags:
- dpo
- unsloth
- qwen
- alignment
- two-stage-training
---
# qwen3-4b-2507-dpo-cot-merged
This model is the result of **two-stage fine-tuning**:
1. **SFT (Supervised Fine-Tuning)**: Training on structured output datasets
2. **DPO (Direct Preference Optimization)**: Alignment using preference data
This repository contains the **full-merged 16-bit weights**. No adapter loading is required.
## Training Pipeline
### Stage 1: SFT
- **Base model**: Qwen/Qwen3-4B-Instruct-2507
- **SFT adapter**: masachika/qwen3-4b-Instruct-2507-structured-output-lora
- **Objective**: Learn to generate structured outputs (JSON, YAML, XML, TOML, CSV)
### Stage 2: DPO (This model)
- **Starting point**: SFT-trained model (merged)
- **Method**: Direct Preference Optimization
- **Dataset**: u-10bei/dpo-dataset-qwen-cot
- **Objective**: Align responses with preferred outputs, improve reasoning quality
## Training Configuration (DPO Stage)
- **Epochs**: 2
- **Learning rate**: 3e-07
- **Beta**: 0.2
- **Max sequence length**: 2048
- **LoRA Config**: r=64, alpha=128 (merged into base)
## Usage
Since this is a merged model, you can use it directly with `transformers`.
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "masachika/qwen3-4b-dpo-cot-merged"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
# 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]))
```
## Sources & License (IMPORTANT)
* **SFT Base**: masachika/qwen3-4b-Instruct-2507-structured-output-lora
* **DPO Training Data**: u-10bei/dpo-dataset-qwen-cot
* **License**: MIT License (as per dataset terms)
* **Compliance**: Users must follow the original base model's license terms