Instructions to use fenyo/Qwen2.5-7B-base2instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fenyo/Qwen2.5-7B-base2instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="fenyo/Qwen2.5-7B-base2instruct") 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") model = AutoModelForCausalLM.from_pretrained("fenyo/Qwen2.5-7B-base2instruct") 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 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" # 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", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/fenyo/Qwen2.5-7B-base2instruct
- SGLang
How to use fenyo/Qwen2.5-7B-base2instruct 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" \ --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", "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" \ --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", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use fenyo/Qwen2.5-7B-base2instruct with Docker Model Runner:
docker model run hf.co/fenyo/Qwen2.5-7B-base2instruct
Qwen2.5-7B-base2instruct (SFT → DPO → RLVR à récompense graduée)
Modèle conversationnel obtenu en post-entraînant nous-mêmes le modèle de base
Qwen/Qwen2.5-7B (non-instruct) via un pipeline complet
SFT → DPO → RLVR, sur un seul GPU H100 80 Go, puis comparé à l'instruct officiel
Qwen/Qwen2.5-7B-Instruct.
Cette version finale utilise un RLVR de suivi d'instructions à récompense GRADUÉE (cf. plus bas), qui apporte le meilleur score IFEval du projet.
📦 Code, scripts et recette complète : https://github.com/AlexandreFenyo/qwen2.5-7b-base2instruct Checkpoints intermédiaires : SFT · DPO
Pipeline
| Étape | Méthode | Données |
|---|---|---|
| 1. SFT | Full fine-tuning (TRL), ChatML, loss réponse seule, liger-kernel | allenai/tulu-3-sft-mixture (180k) |
| 2. DPO | DPO-LoRA (TRL), référence en direct | HuggingFaceH4/ultrafeedback_binarized (10k) |
| 3. RLVR | GRPO-LoRA, récompenses vérifiables : maths (gsm8k) + suivi d'instructions (contraintes vérifiées par programme) |
gsm8k + prompts multi-contraintes générés |
Résultats (lm-evaluation-harness, backend vLLM)
| modèle | IFEval (prompt strict) | GSM8K (flexible) | MMLU |
|---|---|---|---|
| base Qwen2.5-7B | 27.4 | 83.0 | 71.8 |
| + SFT | 44.9 | 77.5 | 69.1 |
| + DPO | 44.7 | 77.1 | 69.9 |
| + RLVR (maths seul) | 45.1 | 77.4 | 69.9 |
| + RLVR (multi binaire) | 44.7 | 76.9 | 69.9 |
| + RLVR (multi GRADUÉ — ce modèle) | 49.5 | 76.8 | 69.9 |
| instruct officiel | 71.9 | 84.7 | 68.8 |
La leçon clé : récompense binaire → graduée
Un premier RLVR de suivi d'instructions avec récompense binaire (1 contrainte/prompt) a échoué
(IFEval inchangé). Cause : effondrement de l'avantage GRPO — dans chaque groupe de générations, toutes
réussissent (contrainte facile) ou toutes échouent (dure) → écart-type nul → gradient nul
(frac_reward_zero_std → 1.0). Le correctif : prompts multi-contraintes + récompense graduée
(fraction satisfaite) → variance intra-groupe non nulle → gradient vivant → IFEval 44.7 → 49.5.
⚠️ Piège d'éval GSM8K :
strict-matchexige le format#### Net pénalise injustement Qwen-Instruct (21 % au lieu de 84.7 %). Chiffres ci-dessus enflexible-extract, 1024 tokens.
Lecture honnête
Le pipeline produit un vrai modèle instruct ; le gain vient surtout du SFT (IFEval 27→45) puis du RLVR gradué (+4.8). On n'égale pas l'instruct officiel sur IFEval (49.5 vs 71.9) : celui-ci s'appuie sur une échelle de données très supérieure (~1M+ SFT, RLVR multi-domaines massif). Aucune régression MMLU.
Utilisation
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("fenyo/Qwen2.5-7B-base2instruct")
model = AutoModelForCausalLM.from_pretrained("fenyo/Qwen2.5-7B-base2instruct", torch_dtype="bfloat16", device_map="auto")
msgs = [{"role": "user", "content": "Explique en deux phrases pourquoi le ciel est bleu."}]
inputs = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
print(tok.decode(model.generate(inputs, max_new_tokens=200)[0][inputs.shape[1]:], skip_special_tokens=True))
Format ChatML, identique à l'instruct officiel.
Crédits
Base/instruct de référence : Qwen2.5 (Alibaba, Apache-2.0). Entraînement : TRL (Hugging Face). Recette et expérience : github.com/AlexandreFenyo/qwen2.5-7b-base2instruct.
- Downloads last month
- 44
Model tree for fenyo/Qwen2.5-7B-base2instruct
Base model
Qwen/Qwen2.5-7B