Instructions to use fdyrd/QwenMath1.0-1.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fdyrd/QwenMath1.0-1.5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="fdyrd/QwenMath1.0-1.5B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("fdyrd/QwenMath1.0-1.5B") model = AutoModelForCausalLM.from_pretrained("fdyrd/QwenMath1.0-1.5B") 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
- vLLM
How to use fdyrd/QwenMath1.0-1.5B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "fdyrd/QwenMath1.0-1.5B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fdyrd/QwenMath1.0-1.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/fdyrd/QwenMath1.0-1.5B
- SGLang
How to use fdyrd/QwenMath1.0-1.5B 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 "fdyrd/QwenMath1.0-1.5B" \ --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": "fdyrd/QwenMath1.0-1.5B", "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 "fdyrd/QwenMath1.0-1.5B" \ --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": "fdyrd/QwenMath1.0-1.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use fdyrd/QwenMath1.0-1.5B with Docker Model Runner:
docker model run hf.co/fdyrd/QwenMath1.0-1.5B
Traning Configuration
epoch: 2.976
batch_size: 2
learning_rate: 0.00001
train_time: "0:10:11.05"
train_samples_per_second: 2.455
train_steps_per_second: 0.304
train_loss: 0.551
total_flos: "4998063GF"
dataset_size: 500
Validation Set Statistics
$(a:n)$ means accuracy and total number of problems.
| Level | Algebra | Intermediate Algebra | Prealgebra | Precalculus | Number Theory | Geometry | Counting & Probability | Average |
|---|---|---|---|---|---|---|---|---|
| Level 1 | 0.681 : 135 | 0.404 : 52 | 0.535 : 86 | 0.263 : 57 | 0.7 : 30 | 0.368 : 38 | 0.538 : 39 | 0.499 |
| Level 2 | 0.532 : 201 | 0.188 : 128 | 0.446 : 177 | 0.062 : 113 | 0.489 : 92 | 0.232 : 82 | 0.366 : 101 | 0.331 |
| Level 3 | 0.41 : 261 | 0.072 : 195 | 0.455 : 224 | 0.0 : 127 | 0.41 : 122 | 0.127 : 102 | 0.34 : 100 | 0.259 |
| Level 4 | 0.329 : 283 | 0.036 : 248 | 0.366 : 191 | 0.018 : 114 | 0.303 : 142 | 0.088 : 125 | 0.216 : 111 | 0.194 |
| Level 5 | 0.156 : 307 | 0.007 : 280 | 0.202 : 193 | 0.0 : 135 | 0.188 : 154 | 0.008 : 132 | 0.065 : 123 | 0.089 |
| Average | 0.422 | 0.141 | 0.401 | 0.069 | 0.418 | 0.165 | 0.305 | 0.249 |
Test Set Statistics
[
{
"dataset": "MATH500",
"url": "https://huggingface.co/datasets/qq8933/MATH500",
"accuracy": 0.410
},
{
"dataset": "GSM8K",
"url": "https://huggingface.co/datasets/openai/gsm8k",
"accuracy": 0.649
}
]
Inference Examples
Basic Arithmetic
Q: Evaluate $1+2\times 3$. A: The expression $1+2\times 3$ means $1$ added to $2\times 3$. So, we have $ 1+2\times 3=1+2\cdot 3 =1+6=\boxed{7}$剌猬
Calculus
Q: compute $\int_{0}^{\pi}\sin{x}\cos{x}dx$. A: We use the double angle formula $\sin{2x} = 2\sin{x}\cos{x}$ to get $\int_{0}^{\pi}\sin{x}\cos{x}dx = \frac{1}{2}\int_{0}^{\pi}\sin{2x}dx$. We use the substitution $u = 2x$ to get $\frac{1}{2}\int_{0}^{\pi}\sin{2x}dx = \frac{1}{2}\int_{0}^{2\pi}\sin{u}du = \frac{1}{2}\left[-\cos{u}\right]{0}^{2\pi} = \frac{1}{2}\left(-\cos{2\pi} + \cos{0}\right) = \boxed{0}$. We can also use the identity $\sin{2x} = 2\sin{x}\cos{x}$ to get $\int{0}^{\pi}\sin{x}\cos{x}dx = \frac{1}{2}\int_{0}^{\pi}\sin{2x}dx = \frac{1}{2}\left[-\cos{2x}\right]_{0}^{\pi} = \frac{1}{2}\left(-\cos{2\pi} + \cos{0}\right) = \boxed{0}$.
Linear Algebra
Q: Find the determinant of the matrix $\begin{bmatrix} 1 & 2 \ 3 & 4 \end{bmatrix}$. A: The determinant of the matrix $\begin{bmatrix} 1 & 2 \ 3 & 4 \end{bmatrix}$ is $1\cdot 4 - 2\cdot 3 = \boxed{-2}$.
- Downloads last month
- 1
Model tree for fdyrd/QwenMath1.0-1.5B
Base model
Qwen/Qwen2.5-1.5B