fdqerq22ds/MathScaleQA-2M
Viewer • Updated • 2M • 110 • 13
How to use fdqerq22ds/MathScale-Mistral with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="fdqerq22ds/MathScale-Mistral") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("fdqerq22ds/MathScale-Mistral")
model = AutoModelForCausalLM.from_pretrained("fdqerq22ds/MathScale-Mistral")How to use fdqerq22ds/MathScale-Mistral with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "fdqerq22ds/MathScale-Mistral"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "fdqerq22ds/MathScale-Mistral",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/fdqerq22ds/MathScale-Mistral
How to use fdqerq22ds/MathScale-Mistral with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "fdqerq22ds/MathScale-Mistral" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "fdqerq22ds/MathScale-Mistral",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "fdqerq22ds/MathScale-Mistral" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "fdqerq22ds/MathScale-Mistral",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use fdqerq22ds/MathScale-Mistral with Docker Model Runner:
docker model run hf.co/fdqerq22ds/MathScale-Mistral
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("fdqerq22ds/MathScale-Mistral")
model = AutoModelForCausalLM.from_pretrained("fdqerq22ds/MathScale-Mistral")This is a reproduced MathScale-Mistral model by finetuning the Mistral-7B-v0.1 on our reproduced MathScaleQA-2M dataset, following the hyperparameters in their original paper to ensure the effectiveness of our reproduction.
Fortunately, the reproduction was smooth, and we managed to match the reported performance metrics when evaluating on their MWPBench. Below, we present a comparison between the performance of their official model and our reproduced model:
| Model | GSM8K | MATH | CollegeMath | TAL | Math23k | Ape210k | GaokaoBench-Math | AGIE-Gaokao-Math | AGIE-SAT-Math | AGIE-MATH | MicroAverage | MacroAverage |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Official MathScale-Mistral | 74.8 | 35.2 | 21.8 | 39.9 | 64.4 | 46.0 | 21.4 | 14.3 | 57.8 | 32.9 | 38.7 | 40.8 |
| Reproduced MathScale-Mistral | 74.0 | 34.5 | 22.0 | 39.6 | 61.7 | 45.1 | 21.6 | 15.5 | 56.8 | 34.4 | 38.3 | 40.5 |
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="fdqerq22ds/MathScale-Mistral")