Instructions to use fenyo/Qwen2.5-7B-base2instruct-DPO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fenyo/Qwen2.5-7B-base2instruct-DPO with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="fenyo/Qwen2.5-7B-base2instruct-DPO") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("fenyo/Qwen2.5-7B-base2instruct-DPO") model = AutoModelForCausalLM.from_pretrained("fenyo/Qwen2.5-7B-base2instruct-DPO") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use fenyo/Qwen2.5-7B-base2instruct-DPO with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "fenyo/Qwen2.5-7B-base2instruct-DPO" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fenyo/Qwen2.5-7B-base2instruct-DPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/fenyo/Qwen2.5-7B-base2instruct-DPO
- SGLang
How to use fenyo/Qwen2.5-7B-base2instruct-DPO with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "fenyo/Qwen2.5-7B-base2instruct-DPO" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fenyo/Qwen2.5-7B-base2instruct-DPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
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 "fenyo/Qwen2.5-7B-base2instruct-DPO" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fenyo/Qwen2.5-7B-base2instruct-DPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use fenyo/Qwen2.5-7B-base2instruct-DPO with Docker Model Runner:
docker model run hf.co/fenyo/Qwen2.5-7B-base2instruct-DPO
Qwen2.5-7B-base2instruct — étape DPO
Checkpoint intermédiaire (SFT + DPO) du pipeline base→instruct SFT → DPO → RLVR appliqué à
Qwen/Qwen2.5-7B. Le DPO aligne le modèle SFT sur des
préférences humaines (réponses choisies vs rejetées).
- ⬅️ Étape précédente (SFT) :
fenyo/Qwen2.5-7B-base2instruct-SFT - 🏁 Modèle final (après RLVR) :
fenyo/Qwen2.5-7B-base2instruct - 📦 Code & recette : https://github.com/AlexandreFenyo/qwen2.5-7b-base2instruct
Entraînement
DPO LoRA (TRL DPOTrainer, r=32), référence calculée en direct, 1 epoch, lr 5e-6, β=0.1,
seq_len 1536, bf16, gradient checkpointing. Adaptateur fusionné dans le modèle. Données :
HuggingFaceH4/ultrafeedback_binarized (10k paires).
Piège résolu :
precompute_ref_log_probs=Trueen bf16 produit des NaN — désactivé. Voir le dépôt GitHub.
Résultats (lm-eval, backend vLLM)
| étape | IFEval (prompt strict) | GSM8K (flexible) | MMLU |
|---|---|---|---|
| base Qwen2.5-7B | 27.4 | 83.0 | 71.8 |
| + SFT | 44.9 | 77.5 | 69.1 |
| + DPO (ce modèle) | 44.7 | 77.1 | 69.9 |
| + RLVR | 45.1 | 77.4 | 69.9 |
Le DPO sur 10k paires génériques bouge peu les benchmarks ici. Analyse complète : dépôt GitHub.
Usage
Format ChatML, via tokenizer.apply_chat_template. Voir l'exemple sur le
modèle final.
- Downloads last month
- 14
Model tree for fenyo/Qwen2.5-7B-base2instruct-DPO
Base model
Qwen/Qwen2.5-7B