Instructions to use peiyi9979/math-shepherd-mistral-7b-prm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use peiyi9979/math-shepherd-mistral-7b-prm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="peiyi9979/math-shepherd-mistral-7b-prm")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("peiyi9979/math-shepherd-mistral-7b-prm") model = AutoModelForCausalLM.from_pretrained("peiyi9979/math-shepherd-mistral-7b-prm", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use peiyi9979/math-shepherd-mistral-7b-prm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "peiyi9979/math-shepherd-mistral-7b-prm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "peiyi9979/math-shepherd-mistral-7b-prm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/peiyi9979/math-shepherd-mistral-7b-prm
- SGLang
How to use peiyi9979/math-shepherd-mistral-7b-prm 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 "peiyi9979/math-shepherd-mistral-7b-prm" \ --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": "peiyi9979/math-shepherd-mistral-7b-prm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "peiyi9979/math-shepherd-mistral-7b-prm" \ --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": "peiyi9979/math-shepherd-mistral-7b-prm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use peiyi9979/math-shepherd-mistral-7b-prm with Docker Model Runner:
docker model run hf.co/peiyi9979/math-shepherd-mistral-7b-prm
Why does the config show this is a LLaMA model?
The tokenizer is also a LLaMA tokenizer...
Hi, this is the tokenizer_class.
https://huggingface.co/mistralai/Mistral-7B-v0.1/blob/main/tokenizer_config.json
https://huggingface.co/peiyi9979/math-shepherd-mistral-7b-prm/blob/main/config.json
But the model config shows that the model's architecture is LlamaForCausalLM?
Hello, mistral and llama have the same model structure, so I used the script of llama to convert the mistral ckpt from deepseek framework to huggingface framework.
There's no problem with the model type. LlamaForCausalLM is ok.
The bos and eos id does have a bit of a problem though.
It should be 1 and 2, not 100000 and 100001.
I've changed it.
However, huggingface's generate function should use tokenizer bos and eos id by default, without using 100000 and 100001, so it has no effect.
Thanks for your patient explanation!