Instructions to use sail/Qwen2.5-Math-7B-Oat-Zero with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sail/Qwen2.5-Math-7B-Oat-Zero with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sail/Qwen2.5-Math-7B-Oat-Zero") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sail/Qwen2.5-Math-7B-Oat-Zero") model = AutoModelForCausalLM.from_pretrained("sail/Qwen2.5-Math-7B-Oat-Zero") 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sail/Qwen2.5-Math-7B-Oat-Zero with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sail/Qwen2.5-Math-7B-Oat-Zero" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sail/Qwen2.5-Math-7B-Oat-Zero", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sail/Qwen2.5-Math-7B-Oat-Zero
- SGLang
How to use sail/Qwen2.5-Math-7B-Oat-Zero 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 "sail/Qwen2.5-Math-7B-Oat-Zero" \ --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": "sail/Qwen2.5-Math-7B-Oat-Zero", "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 "sail/Qwen2.5-Math-7B-Oat-Zero" \ --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": "sail/Qwen2.5-Math-7B-Oat-Zero", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sail/Qwen2.5-Math-7B-Oat-Zero with Docker Model Runner:
docker model run hf.co/sail/Qwen2.5-Math-7B-Oat-Zero
Add question-answering pipeline tag and link to Hugging Face paper
#1
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,15 +1,16 @@
|
|
| 1 |
---
|
| 2 |
-
library_name: transformers
|
| 3 |
-
license: apache-2.0
|
| 4 |
base_model:
|
| 5 |
- Qwen/Qwen2.5-Math-7B
|
|
|
|
|
|
|
|
|
|
| 6 |
---
|
| 7 |
|
| 8 |
# Qwen2.5-Math-7B-Oat-Zero
|
| 9 |
|
| 10 |
## Links
|
| 11 |
|
| 12 |
-
- π [Paper](https://
|
| 13 |
- π» [GitHub](https://github.com/sail-sg/understand-r1-zero)
|
| 14 |
- π€ [Oat-Zero Collection](https://huggingface.co/collections/sail/oat-zero-understanding-r1-zero-like-training-67dcdb07b9f3eb05f1501c4a)
|
| 15 |
|
|
@@ -33,17 +34,24 @@ import vllm
|
|
| 33 |
|
| 34 |
def apply_qwen_math_template(question: str):
|
| 35 |
return (
|
| 36 |
-
"<|im_start|>system
|
|
|
|
|
|
|
|
|
|
| 37 |
+ question
|
| 38 |
-
+ "<|im_end|>
|
|
|
|
|
|
|
| 39 |
)
|
| 40 |
|
| 41 |
def apply_r1_template(question: str):
|
| 42 |
return (
|
| 43 |
"A conversation between User and Assistant. The User asks a question, and the Assistant solves it. The Assistant first thinks about the reasoning process in the mind and then provides the User with the answer. "
|
| 44 |
-
"The reasoning process is enclosed within <think> </think> and answer is enclosed within <answer> </answer> tags, respectively, i.e., <think> reasoning process here </think> <answer> answer here </answer>.
|
|
|
|
| 45 |
+ question
|
| 46 |
-
+ "
|
|
|
|
| 47 |
)
|
| 48 |
|
| 49 |
model_name = "sail/Qwen2.5-Math-7B-Oat-Zero"
|
|
@@ -85,4 +93,4 @@ print(outputs)
|
|
| 85 |
year={2025},
|
| 86 |
howpublished={\url{https://github.com/sail-sg/understand-r1-zero}},
|
| 87 |
}
|
| 88 |
-
```
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
| 2 |
base_model:
|
| 3 |
- Qwen/Qwen2.5-Math-7B
|
| 4 |
+
library_name: transformers
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
pipeline_tag: question-answering
|
| 7 |
---
|
| 8 |
|
| 9 |
# Qwen2.5-Math-7B-Oat-Zero
|
| 10 |
|
| 11 |
## Links
|
| 12 |
|
| 13 |
+
- π [Paper](https://huggingface.co/papers/2503.20783)
|
| 14 |
- π» [GitHub](https://github.com/sail-sg/understand-r1-zero)
|
| 15 |
- π€ [Oat-Zero Collection](https://huggingface.co/collections/sail/oat-zero-understanding-r1-zero-like-training-67dcdb07b9f3eb05f1501c4a)
|
| 16 |
|
|
|
|
| 34 |
|
| 35 |
def apply_qwen_math_template(question: str):
|
| 36 |
return (
|
| 37 |
+
"<|im_start|>system
|
| 38 |
+
Please reason step by step, and put your final answer within \\boxed{}.<|im_end|>
|
| 39 |
+
<|im_start|>user
|
| 40 |
+
"
|
| 41 |
+ question
|
| 42 |
+
+ "<|im_end|>
|
| 43 |
+
<|im_start|>assistant
|
| 44 |
+
"
|
| 45 |
)
|
| 46 |
|
| 47 |
def apply_r1_template(question: str):
|
| 48 |
return (
|
| 49 |
"A conversation between User and Assistant. The User asks a question, and the Assistant solves it. The Assistant first thinks about the reasoning process in the mind and then provides the User with the answer. "
|
| 50 |
+
"The reasoning process is enclosed within <think> </think> and answer is enclosed within <answer> </answer> tags, respectively, i.e., <think> reasoning process here </think> <answer> answer here </answer>.
|
| 51 |
+
User: "
|
| 52 |
+ question
|
| 53 |
+
+ "
|
| 54 |
+
Assistant: <think>"
|
| 55 |
)
|
| 56 |
|
| 57 |
model_name = "sail/Qwen2.5-Math-7B-Oat-Zero"
|
|
|
|
| 93 |
year={2025},
|
| 94 |
howpublished={\url{https://github.com/sail-sg/understand-r1-zero}},
|
| 95 |
}
|
| 96 |
+
```
|