Text Generation
Transformers
Safetensors
qwen2
Generated from Trainer
open-r1
trl
grpo
conversational
text-generation-inference
Instructions to use Yukang/Qwen2.5-3B-Open-R1-Code-GRPO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Yukang/Qwen2.5-3B-Open-R1-Code-GRPO with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Yukang/Qwen2.5-3B-Open-R1-Code-GRPO") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Yukang/Qwen2.5-3B-Open-R1-Code-GRPO") model = AutoModelForCausalLM.from_pretrained("Yukang/Qwen2.5-3B-Open-R1-Code-GRPO", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Yukang/Qwen2.5-3B-Open-R1-Code-GRPO with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Yukang/Qwen2.5-3B-Open-R1-Code-GRPO" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Yukang/Qwen2.5-3B-Open-R1-Code-GRPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Yukang/Qwen2.5-3B-Open-R1-Code-GRPO
- SGLang
How to use Yukang/Qwen2.5-3B-Open-R1-Code-GRPO 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 "Yukang/Qwen2.5-3B-Open-R1-Code-GRPO" \ --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": "Yukang/Qwen2.5-3B-Open-R1-Code-GRPO", "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 "Yukang/Qwen2.5-3B-Open-R1-Code-GRPO" \ --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": "Yukang/Qwen2.5-3B-Open-R1-Code-GRPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Yukang/Qwen2.5-3B-Open-R1-Code-GRPO with Docker Model Runner:
docker model run hf.co/Yukang/Qwen2.5-3B-Open-R1-Code-GRPO
Model save
Browse files- README.md +2 -4
- all_results.json +4 -4
- train_results.json +4 -4
- trainer_state.json +37 -9
README.md
CHANGED
|
@@ -1,11 +1,9 @@
|
|
| 1 |
---
|
| 2 |
base_model: Qwen/Qwen2.5-3B-Instruct
|
| 3 |
-
datasets: open-r1/verifiable-coding-problems-python
|
| 4 |
library_name: transformers
|
| 5 |
model_name: Qwen2.5-3B-Open-R1-Code-GRPO
|
| 6 |
tags:
|
| 7 |
- generated_from_trainer
|
| 8 |
-
- open-r1
|
| 9 |
- trl
|
| 10 |
- grpo
|
| 11 |
licence: license
|
|
@@ -13,7 +11,7 @@ licence: license
|
|
| 13 |
|
| 14 |
# Model Card for Qwen2.5-3B-Open-R1-Code-GRPO
|
| 15 |
|
| 16 |
-
This model is a fine-tuned version of [Qwen/Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct)
|
| 17 |
It has been trained using [TRL](https://github.com/huggingface/trl).
|
| 18 |
|
| 19 |
## Quick start
|
|
@@ -29,7 +27,7 @@ print(output["generated_text"])
|
|
| 29 |
|
| 30 |
## Training procedure
|
| 31 |
|
| 32 |
-
[<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="150" height="24"/>](https://wandb.ai/chenyukang2020-nvidia/huggingface/runs/
|
| 33 |
|
| 34 |
|
| 35 |
This model was trained with GRPO, a method introduced in [DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models](https://huggingface.co/papers/2402.03300).
|
|
|
|
| 1 |
---
|
| 2 |
base_model: Qwen/Qwen2.5-3B-Instruct
|
|
|
|
| 3 |
library_name: transformers
|
| 4 |
model_name: Qwen2.5-3B-Open-R1-Code-GRPO
|
| 5 |
tags:
|
| 6 |
- generated_from_trainer
|
|
|
|
| 7 |
- trl
|
| 8 |
- grpo
|
| 9 |
licence: license
|
|
|
|
| 11 |
|
| 12 |
# Model Card for Qwen2.5-3B-Open-R1-Code-GRPO
|
| 13 |
|
| 14 |
+
This model is a fine-tuned version of [Qwen/Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct).
|
| 15 |
It has been trained using [TRL](https://github.com/huggingface/trl).
|
| 16 |
|
| 17 |
## Quick start
|
|
|
|
| 27 |
|
| 28 |
## Training procedure
|
| 29 |
|
| 30 |
+
[<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="150" height="24"/>](https://wandb.ai/chenyukang2020-nvidia/huggingface/runs/qcoxdthk)
|
| 31 |
|
| 32 |
|
| 33 |
This model was trained with GRPO, a method introduced in [DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models](https://huggingface.co/papers/2402.03300).
|
all_results.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
{
|
| 2 |
"total_flos": 0.0,
|
| 3 |
-
"train_loss":
|
| 4 |
-
"train_runtime":
|
| 5 |
"train_samples": 35735,
|
| 6 |
-
"train_samples_per_second":
|
| 7 |
-
"train_steps_per_second":
|
| 8 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"total_flos": 0.0,
|
| 3 |
+
"train_loss": 1.1849556259693362e-06,
|
| 4 |
+
"train_runtime": 75.2959,
|
| 5 |
"train_samples": 35735,
|
| 6 |
+
"train_samples_per_second": 3399.921,
|
| 7 |
+
"train_steps_per_second": 6.64
|
| 8 |
}
|
train_results.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
{
|
| 2 |
"total_flos": 0.0,
|
| 3 |
-
"train_loss":
|
| 4 |
-
"train_runtime":
|
| 5 |
"train_samples": 35735,
|
| 6 |
-
"train_samples_per_second":
|
| 7 |
-
"train_steps_per_second":
|
| 8 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"total_flos": 0.0,
|
| 3 |
+
"train_loss": 1.1849556259693362e-06,
|
| 4 |
+
"train_runtime": 75.2959,
|
| 5 |
"train_samples": 35735,
|
| 6 |
+
"train_samples_per_second": 3399.921,
|
| 7 |
+
"train_steps_per_second": 6.64
|
| 8 |
}
|
trainer_state.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
| 2 |
"best_global_step": null,
|
| 3 |
"best_metric": null,
|
| 4 |
"best_model_checkpoint": null,
|
| 5 |
-
"epoch": 0.
|
| 6 |
"eval_steps": 500,
|
| 7 |
-
"global_step":
|
| 8 |
"is_hyper_param_search": false,
|
| 9 |
"is_local_process_zero": true,
|
| 10 |
"is_world_process_zero": true,
|
|
@@ -14178,18 +14178,46 @@
|
|
| 14178 |
"step": 506
|
| 14179 |
},
|
| 14180 |
{
|
| 14181 |
-
"
|
| 14182 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14183 |
"total_flos": 0.0,
|
| 14184 |
-
"train_loss":
|
| 14185 |
-
"train_runtime":
|
| 14186 |
-
"train_samples_per_second":
|
| 14187 |
-
"train_steps_per_second":
|
| 14188 |
}
|
| 14189 |
],
|
| 14190 |
"logging_steps": 1,
|
| 14191 |
"max_steps": 500,
|
| 14192 |
-
"num_input_tokens_seen":
|
| 14193 |
"num_train_epochs": 1,
|
| 14194 |
"save_steps": 50,
|
| 14195 |
"stateful_callbacks": {
|
|
|
|
| 2 |
"best_global_step": null,
|
| 3 |
"best_metric": null,
|
| 4 |
"best_model_checkpoint": null,
|
| 5 |
+
"epoch": 0.4539959704499664,
|
| 6 |
"eval_steps": 500,
|
| 7 |
+
"global_step": 507,
|
| 8 |
"is_hyper_param_search": false,
|
| 9 |
"is_local_process_zero": true,
|
| 10 |
"is_world_process_zero": true,
|
|
|
|
| 14178 |
"step": 506
|
| 14179 |
},
|
| 14180 |
{
|
| 14181 |
+
"clip_ratio/high_max": 0.0,
|
| 14182 |
+
"clip_ratio/high_mean": 0.0,
|
| 14183 |
+
"clip_ratio/low_mean": 0.0,
|
| 14184 |
+
"clip_ratio/low_min": 0.0,
|
| 14185 |
+
"clip_ratio/region_mean": 0.0,
|
| 14186 |
+
"completions/clipped_ratio": -6.984375,
|
| 14187 |
+
"completions/max_length": 1327.0,
|
| 14188 |
+
"completions/max_terminated_length": 1327.0,
|
| 14189 |
+
"completions/mean_length": 600.677734375,
|
| 14190 |
+
"completions/mean_terminated_length": 599.6751708984375,
|
| 14191 |
+
"completions/min_length": 164.0,
|
| 14192 |
+
"completions/min_terminated_length": 164.0,
|
| 14193 |
+
"epoch": 0.4539959704499664,
|
| 14194 |
+
"frac_reward_zero_std": 1.0,
|
| 14195 |
+
"grad_norm": 0.02131276823537405,
|
| 14196 |
+
"kl": 0.06005859375,
|
| 14197 |
+
"learning_rate": 5.016990909400706e-07,
|
| 14198 |
+
"loss": 0.0006,
|
| 14199 |
+
"num_tokens": 305445491.0,
|
| 14200 |
+
"reward": 0.10000000149011612,
|
| 14201 |
+
"reward_std": 0.0,
|
| 14202 |
+
"rewards/code_reward/mean": 0.0,
|
| 14203 |
+
"rewards/code_reward/std": 0.0,
|
| 14204 |
+
"rewards/format_reward/mean": 1.0,
|
| 14205 |
+
"rewards/format_reward/std": 0.0,
|
| 14206 |
+
"step": 507
|
| 14207 |
+
},
|
| 14208 |
+
{
|
| 14209 |
+
"epoch": 0.4539959704499664,
|
| 14210 |
+
"step": 507,
|
| 14211 |
"total_flos": 0.0,
|
| 14212 |
+
"train_loss": 1.1849556259693362e-06,
|
| 14213 |
+
"train_runtime": 75.2959,
|
| 14214 |
+
"train_samples_per_second": 3399.921,
|
| 14215 |
+
"train_steps_per_second": 6.64
|
| 14216 |
}
|
| 14217 |
],
|
| 14218 |
"logging_steps": 1,
|
| 14219 |
"max_steps": 500,
|
| 14220 |
+
"num_input_tokens_seen": 305445491,
|
| 14221 |
"num_train_epochs": 1,
|
| 14222 |
"save_steps": 50,
|
| 14223 |
"stateful_callbacks": {
|