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)
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. Objectif de l'expérience : identifier une recette
reproductible base→instruct et comparer le résultat à l'instruct officiel
Qwen/Qwen2.5-7B-Instruct dérivé de la même base.
📦 Code, scripts et recette complète : https://github.com/AlexandreFenyo/qwen2.5-7b-base2instruct
Checkpoints intermédiaires (pour suivre la progression) : SFT → DPO → RLVR (ce modèle).
Ce qu'on a fait
| Étape | Méthode | Données |
|---|---|---|
| 1. SFT | Full fine-tuning (TRL), format ChatML, loss réponse seule, liger-kernel | allenai/tulu-3-sft-mixture (180k) |
| 2. DPO | DPO-LoRA (TRL), référence calculée en direct | HuggingFaceH4/ultrafeedback_binarized (10k paires) |
| 3. RLVR | GRPO-LoRA (TRL), récompense vérifiable (math-verify), sans reward-model | openai/gsm8k (7k, format \boxed{}) |
Hyperparamètres : lr SFT 5e-6 / DPO 5e-6 (β=0.1) / RLVR 1e-6, bf16, attention SDPA, suivi wandb. Recette intégrale et pièges : voir le dépôt GitHub.
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 (ce modèle) | 45.1 | 77.4 | 69.9 |
| instruct officiel | 71.9 | 84.7 | 68.8 |
Lecture honnête : le gain instruct vient surtout du SFT (IFEval 27→45). Notre RLVR ne ciblait que les maths, donc il n'améliore pas le suivi d'instructions (IFEval). On n'égale pas encore l'instruct officiel sur IFEval (45 vs 72) : celui-ci utilise beaucoup plus de données SFT et un RLVR multi-domaines incluant des récompenses de suivi d'instructions. Aucune régression notable sur MMLU.
⚠️ Piège d'éval : en
strict-match, l'instruct officiel chutait à 21 % sur GSM8K (il n'émet pas le format#### N) — pur artefact. Mesuré équitablement (flexible-extract, 1024 tokens) : 84.7 %.
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 (<|im_start|>role ... <|im_end|>), identique à l'instruct officiel.
Limites
Modèle expérimental (preuve de recette sur 1 GPU). Suivi d'instructions encore en retrait de l'instruct officiel. Peut halluciner. RLVR limité aux maths. Voir le dépôt GitHub pour les leviers d'amélioration.
Crédits
Base et instruct de référence : Qwen2.5 (Alibaba, Apache-2.0). Pipeline d'entraînement : TRL (Hugging Face). Expérience et recette : github.com/AlexandreFenyo/qwen2.5-7b-base2instruct.
- Downloads last month
- -
Model tree for fenyo/Qwen2.5-7B-base2instruct
Base model
Qwen/Qwen2.5-7B