Text Generation
Transformers
Safetensors
qwen2
Generated from Trainer
trl
grpo
conversational
text-generation-inference
Instructions to use Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math") 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("Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math") model = AutoModelForCausalLM.from_pretrained("Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math", 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 Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math
- SGLang
How to use Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math 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 "Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math" \ --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": "Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math", "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 "Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math" \ --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": "Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math with Docker Model Runner:
docker model run hf.co/Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math
Download trainer_state.json from Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math: direct link, hf CLI and curl.
- Browser
- Download file 3.2 kB
-
https://huggingface.co/Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math/resolve/main/trainer_state.json
- Command line
-
hf download hf://Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math/trainer_state.json
-
curl -L -o trainer_state.json https://huggingface.co/Ziyao1010/Qwen2.5-1.5B-Open-R1-GRPO-Math/resolve/main/trainer_state.json
3.2 kB
| { | |
| "best_global_step": null, | |
| "best_metric": null, | |
| "best_model_checkpoint": null, | |
| "epoch": 0.9230769230769231, | |
| "eval_steps": 500, | |
| "global_step": 3, | |
| "is_hyper_param_search": false, | |
| "is_local_process_zero": true, | |
| "is_world_process_zero": true, | |
| "log_history": [ | |
| { | |
| "clip_ratio/high_max": 0.0, | |
| "clip_ratio/high_mean": 0.0, | |
| "clip_ratio/low_mean": 0.0, | |
| "clip_ratio/low_min": 0.0, | |
| "clip_ratio/region_mean": 0.0, | |
| "completions/clipped_ratio": -5.921875, | |
| "completions/max_length": 1024.0, | |
| "completions/max_terminated_length": 1020.0, | |
| "completions/mean_length": 674.978515625, | |
| "completions/mean_terminated_length": 620.6162719726562, | |
| "completions/min_length": 44.0, | |
| "completions/min_terminated_length": 44.0, | |
| "epoch": 0.3076923076923077, | |
| "frac_reward_zero_std": 0.28125, | |
| "grad_norm": 0.24190807765558528, | |
| "kl": 0.00023603439331054688, | |
| "learning_rate": 0.0, | |
| "loss": 0.0155, | |
| "num_tokens": 417029.0, | |
| "reward": 0.06982421875, | |
| "reward_std": 0.17549802362918854, | |
| "rewards/accuracy_reward/mean": 0.05078125, | |
| "rewards/accuracy_reward/std": 0.21976542472839355, | |
| "rewards/format_reward/mean": 0.001953125, | |
| "rewards/format_reward/std": 0.04419417306780815, | |
| "rewards/tag_count_reward/mean": 0.01708984375, | |
| "rewards/tag_count_reward/std": 0.10527165234088898, | |
| "step": 1 | |
| }, | |
| { | |
| "clip_ratio/high_max": 0.0, | |
| "clip_ratio/high_mean": 0.0, | |
| "clip_ratio/low_mean": 0.0, | |
| "clip_ratio/low_min": 0.0, | |
| "clip_ratio/region_mean": 0.0, | |
| "completions/clipped_ratio": -6.3671875, | |
| "completions/max_length": 1024.0, | |
| "completions/max_terminated_length": 1023.0, | |
| "completions/mean_length": 652.9970703125, | |
| "completions/mean_terminated_length": 621.1537475585938, | |
| "completions/min_length": 82.5, | |
| "completions/min_terminated_length": 82.5, | |
| "epoch": 0.9230769230769231, | |
| "frac_reward_zero_std": 0.171875, | |
| "kl": 0.006235480308532715, | |
| "num_tokens": 1242274.0, | |
| "reward": 0.33154296875, | |
| "reward_std": 0.2335953712463379, | |
| "rewards/accuracy_reward/mean": 0.0263671875, | |
| "rewards/accuracy_reward/std": 0.1589299514889717, | |
| "rewards/format_reward/mean": 0.009765625, | |
| "rewards/format_reward/std": 0.09631745889782906, | |
| "rewards/tag_count_reward/mean": 0.29541015625, | |
| "rewards/tag_count_reward/std": 0.2025153785943985, | |
| "step": 3, | |
| "total_flos": 0.0, | |
| "train_loss": 0.011118112752834955, | |
| "train_runtime": 226.5086, | |
| "train_samples_per_second": 0.441, | |
| "train_steps_per_second": 0.018 | |
| } | |
| ], | |
| "logging_steps": 10, | |
| "max_steps": 4, | |
| "num_input_tokens_seen": 1242274, | |
| "num_train_epochs": 1, | |
| "save_steps": 500, | |
| "stateful_callbacks": { | |
| "TrainerControl": { | |
| "args": { | |
| "should_epoch_stop": false, | |
| "should_evaluate": false, | |
| "should_log": false, | |
| "should_save": false, | |
| "should_training_stop": false | |
| }, | |
| "attributes": {} | |
| } | |
| }, | |
| "total_flos": 0.0, | |
| "train_batch_size": 16, | |
| "trial_name": null, | |
| "trial_params": null | |
| } | |