Text Generation
Transformers
Safetensors
English
qwen2
math
conversational
text-generation-inference
Instructions to use codewithdark/deepmath-7b-m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use codewithdark/deepmath-7b-m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="codewithdark/deepmath-7b-m") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("codewithdark/deepmath-7b-m") model = AutoModelForCausalLM.from_pretrained("codewithdark/deepmath-7b-m", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use codewithdark/deepmath-7b-m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "codewithdark/deepmath-7b-m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "codewithdark/deepmath-7b-m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/codewithdark/deepmath-7b-m
- SGLang
How to use codewithdark/deepmath-7b-m 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 "codewithdark/deepmath-7b-m" \ --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": "codewithdark/deepmath-7b-m", "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 "codewithdark/deepmath-7b-m" \ --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": "codewithdark/deepmath-7b-m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use codewithdark/deepmath-7b-m with Docker Model Runner:
docker model run hf.co/codewithdark/deepmath-7b-m
File size: 2,795 Bytes
2bbfc30 3face5d 2bbfc30 3face5d 2bbfc30 3face5d 2bbfc30 3face5d 2bbfc30 3face5d 2bbfc30 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | ---
library_name: transformers
tags:
- math
license: mit
datasets:
- openai/gsm8k
language:
- en
base_model:
- deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B
pipeline_tag: text-generation
---
# DeepMath-7B-M
## Model Overview
DeepMath-7B-M is a fine-tuned version of [DeepSeek-R1-Distill-Qwen-1.5B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B) on the [GSM8K dataset](https://huggingface.co/datasets/gsm8k). This model is designed for mathematical reasoning and problem-solving, excelling in arithmetic, algebra, and word problems.
## Model Details
- **Base Model:** DeepSeek-R1-Distill-Qwen-1.5B
- **Fine-Tuning Dataset:** GSM8K
- **Parameters:** 1.5 Billion
- **Task:** Mathematical Question Answering (Math QA)
- **Repository:** [codewithdark/deepmath-7b-m](https://huggingface.co/codewithdark/deepmath-7b-m)
- **Commit Message:** "Full merged model for math QA"
## Training Details
- **Dataset:** GSM8K (Grade School Math 8K) - a high-quality dataset for mathematical reasoning
- **Fine-Tuning Framework:** Hugging Face Transformers & PyTorch
- **Optimization Techniques:**
- AdamW Optimizer
- Learning rate scheduling
- Gradient accumulation
- Mixed precision training (FP16)
- **Training Steps:** Multiple epochs on a high-performance GPU cluster
## Capabilities & Performance
DeepMath-7B-M excels in:
- Solving word problems with step-by-step reasoning
- Performing algebraic and arithmetic computations
- Understanding complex problem structures
- Generating structured solutions with explanations
## Usage
You can load and use the model via the Hugging Face `transformers` library:
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("codewithdark/deepmath-7b-m")
model = AutoModelForCausalLM.from_pretrained("codewithdark/deepmath-7b-m")
input_text = "A farmer has 5 chickens and each lays 3 eggs a day. How many eggs in total after a week?"
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs, max_length=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
## Limitations
- May struggle with extremely complex mathematical proofs
- Performance is limited to the scope of GSM8K-type problems
- Potential biases in training data
## Future Work
- Extending training to more diverse math datasets
- Exploring larger models for improved accuracy
- Fine-tuning on physics and higher-level mathematical reasoning datasets
## License
This model is released under the mit License.
## Citation
If you use this model, please cite:
```bibtex
@misc{DeepMath-7B-M,
author = {Ahsan},
title = {DeepMath-7B-M: Fine-Tuned DeepSeek-R1-Distill-Qwen-1.5B on GSM8K},
year = {2025},
url = {https://huggingface.co/codewithdark/deepmath-7b-m}
}
```
|