meta-math/MetaMathQA
Viewer • Updated • 395k • 63.3k • 457
How to use sid172002/deepseek-math-7b-3epoch-678k-fullft with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="sid172002/deepseek-math-7b-3epoch-678k-fullft")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("sid172002/deepseek-math-7b-3epoch-678k-fullft")
model = AutoModelForCausalLM.from_pretrained("sid172002/deepseek-math-7b-3epoch-678k-fullft")
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]:]))How to use sid172002/deepseek-math-7b-3epoch-678k-fullft with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "sid172002/deepseek-math-7b-3epoch-678k-fullft"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "sid172002/deepseek-math-7b-3epoch-678k-fullft",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/sid172002/deepseek-math-7b-3epoch-678k-fullft
How to use sid172002/deepseek-math-7b-3epoch-678k-fullft with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "sid172002/deepseek-math-7b-3epoch-678k-fullft" \
--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": "sid172002/deepseek-math-7b-3epoch-678k-fullft",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "sid172002/deepseek-math-7b-3epoch-678k-fullft" \
--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": "sid172002/deepseek-math-7b-3epoch-678k-fullft",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use sid172002/deepseek-math-7b-3epoch-678k-fullft with Docker Model Runner:
docker model run hf.co/sid172002/deepseek-math-7b-3epoch-678k-fullft
Model ID: sid172002/deepseek-math-7b-3epoch-678k-fullft
Fully fine-tuned DeepSeek Math 7B on 678K high-quality math problems. +17.8% improvement over base model on GSM8K (64.2% → 82.0%).
| Metric | Value |
|---|---|
| Parameters | 7 Billion |
| Training Steps | 63,609 |
| Epochs | 3.0 |
| Dataset Size | 678,494 samples |
| GSM8K Score | 82.0% |
| Training Loss | 0.6394 |
| Eval Loss | 0.6411 |
| Benchmark | Score | Base | Improvement |
|---|---|---|---|
| GSM8K | 82.0% | 64.2% | +17.8% |
| MathBench | 92.0% | ~70% | +22% |
| MMLU | Pending | - | Leaderboard Eval |
| MATH | TBD | 33.2% | In Progress |
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"sid172002/deepseek-math-7b-3epoch-678k-fullft",
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(
"sid172002/deepseek-math-7b-3epoch-678k-fullft",
trust_remote_code=True
)
# Solve math problem
problem = "What is 2x + 5 = 13?"
prompt = f"Solve step by step:\n\n{problem}\n\nSolution:\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
Base model
deepseek-ai/deepseek-math-7b-base