Instructions to use Habibur2/Qwen2.5-Math-1.5B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Habibur2/Qwen2.5-Math-1.5B-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Habibur2/Qwen2.5-Math-1.5B-GGUF", filename="qwen-math-1.5b-q4_k_m.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - llama-cpp-python
How to use Habibur2/Qwen2.5-Math-1.5B-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Habibur2/Qwen2.5-Math-1.5B-GGUF", filename="qwen-math-1.5b-q4_k_m.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use Habibur2/Qwen2.5-Math-1.5B-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M
Use Docker
docker model run hf.co/Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use Habibur2/Qwen2.5-Math-1.5B-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Habibur2/Qwen2.5-Math-1.5B-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Habibur2/Qwen2.5-Math-1.5B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M
- Ollama
How to use Habibur2/Qwen2.5-Math-1.5B-GGUF with Ollama:
ollama run hf.co/Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M
- Unsloth Studio new
How to use Habibur2/Qwen2.5-Math-1.5B-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Habibur2/Qwen2.5-Math-1.5B-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Habibur2/Qwen2.5-Math-1.5B-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Habibur2/Qwen2.5-Math-1.5B-GGUF to start chatting
- Pi new
How to use Habibur2/Qwen2.5-Math-1.5B-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use Habibur2/Qwen2.5-Math-1.5B-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use Habibur2/Qwen2.5-Math-1.5B-GGUF with Docker Model Runner:
docker model run hf.co/Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M
- Lemonade
How to use Habibur2/Qwen2.5-Math-1.5B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Habibur2/Qwen2.5-Math-1.5B-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Qwen2.5-Math-1.5B-GGUF-Q4_K_M
List all available models
lemonade list
🧮 Qwen 2.5 Math 1.5B (GGUF Quantized)
This repository contains the GGUF quantized version of the Qwen 2.5 Math 1.5B model.
It is a specialized Mathematical Reasoning Model optimized for edge devices, offline usage, and educational apps. Despite its small size (1.5B), it outperforms many larger general-purpose models in complex mathematical problem-solving tasks.
Quantized By: Md Habibur Rahman (Aasif)
Quantization Format: GGUF (Q4_K_M) - Optimized for balance between Math Accuracy and Speed.
🌟 Key Features
- Math Specialist: Specifically trained on massive mathematical datasets (Algebra, Calculus, Geometry, Logic).
- Chain-of-Thought (CoT): Capable of showing step-by-step reasoning for solving problems.
- Edge AI Ready: Extremely lightweight (~1 GB). Runs smoothly on Android, Raspberry Pi, and Older Laptops.
- Offline Capable: Does not require an internet connection to solve problems.
🚀 Usage (Python)
You can run this model using the llama-cpp-python library.
1. Installation
pip install llama-cpp-python huggingface_hub
- Python Inference Code
Here is a script to solve math problems with step-by-step logic:
from huggingface_hub import hf_hub_download
from llama_cpp import Llama
# Download the model
model_path = hf_hub_download(
repo_id="Habibur2/Qwen2.5-Math-1.5B-GGUF",
filename="qwen-math-1.5b-q4_k_m.gguf"
)
# Load Model
# Set n_gpu_layers=-1 for full GPU usage (Fastest)
# Set n_gpu_layers=0 for CPU only
llm = Llama(
model_path=model_path,
n_ctx=2048, # Context Window
n_threads=4, # CPU Threads
n_gpu_layers=-1 # GPU Acceleration
)
# Define a Math Problem
math_problem = "Find the integral of x^2 + 5x with respect to x."
# System Prompt is Crucial for Math Models
messages = [
{"role": "system", "content": "You are a helpful mathematical assistant. Please solve the problem step-by-step and show your reasoning clearly."},
{"role": "user", "content": math_problem}
]
# Generate Solution
output = llm.create_chat_completion(
messages=messages,
max_tokens=1024, # Math solutions need more tokens
temperature=0.1 # Low temperature (0.1) is best for precise math
)
print("🤖 Solution:\n")
print(output['choices'][0]['message']['content'])
⚙️ Technical Specifications
Feature,Details Original Model,Qwen 2.5 Math 1.5B Instruct Architecture,"Transformer (RoPE, SwiGLU)" Parameters,1.5 Billion Quantization Type,Q4_K_M (4-bit Medium) File Size,~1.12 GB Recommended RAM,2 GB+
🧪 Benchmark & Capabilities
This model excels at:
Algebra & Arithmetic: Solving equations, inequalities, and basic operations.
Calculus: Differentiation and Integration problems.
Word Problems: Understanding and translating text into mathematical equations.
LaTeX Output: Can generate answers in LaTeX format for academic rendering.
👨💻 About the Project
This model was quantized and uploaded by Md Habibur Rahman as part of a research initiative on Offline Edge AI & Small Language Models (SLM). The goal is to democratize access to powerful educational AI tools without relying on heavy cloud infrastructure.
Disclaimer: While this model is highly capable, always verify complex mathematical solutions.
- Downloads last month
- 20
4-bit