Text Generation
Transformers
GGUF
mistral
quantized
2-bit
3-bit
4-bit precision
5-bit
6-bit
8-bit precision
GGUF
Instructions to use MaziyarPanahi/mathstral-7B-v0.1-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MaziyarPanahi/mathstral-7B-v0.1-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MaziyarPanahi/mathstral-7B-v0.1-GGUF")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("MaziyarPanahi/mathstral-7B-v0.1-GGUF", dtype="auto") - llama-cpp-python
How to use MaziyarPanahi/mathstral-7B-v0.1-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="MaziyarPanahi/mathstral-7B-v0.1-GGUF", filename="mathstral-7B-v0.1.IQ1_M.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use MaziyarPanahi/mathstral-7B-v0.1-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf MaziyarPanahi/mathstral-7B-v0.1-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf MaziyarPanahi/mathstral-7B-v0.1-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf MaziyarPanahi/mathstral-7B-v0.1-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf MaziyarPanahi/mathstral-7B-v0.1-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 MaziyarPanahi/mathstral-7B-v0.1-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf MaziyarPanahi/mathstral-7B-v0.1-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 MaziyarPanahi/mathstral-7B-v0.1-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf MaziyarPanahi/mathstral-7B-v0.1-GGUF:Q4_K_M
Use Docker
docker model run hf.co/MaziyarPanahi/mathstral-7B-v0.1-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use MaziyarPanahi/mathstral-7B-v0.1-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MaziyarPanahi/mathstral-7B-v0.1-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MaziyarPanahi/mathstral-7B-v0.1-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MaziyarPanahi/mathstral-7B-v0.1-GGUF:Q4_K_M
- SGLang
How to use MaziyarPanahi/mathstral-7B-v0.1-GGUF 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 "MaziyarPanahi/mathstral-7B-v0.1-GGUF" \ --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": "MaziyarPanahi/mathstral-7B-v0.1-GGUF", "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 "MaziyarPanahi/mathstral-7B-v0.1-GGUF" \ --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": "MaziyarPanahi/mathstral-7B-v0.1-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use MaziyarPanahi/mathstral-7B-v0.1-GGUF with Ollama:
ollama run hf.co/MaziyarPanahi/mathstral-7B-v0.1-GGUF:Q4_K_M
- Unsloth Studio
How to use MaziyarPanahi/mathstral-7B-v0.1-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 MaziyarPanahi/mathstral-7B-v0.1-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 MaziyarPanahi/mathstral-7B-v0.1-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for MaziyarPanahi/mathstral-7B-v0.1-GGUF to start chatting
- Atomic Chat new
- Docker Model Runner
How to use MaziyarPanahi/mathstral-7B-v0.1-GGUF with Docker Model Runner:
docker model run hf.co/MaziyarPanahi/mathstral-7B-v0.1-GGUF:Q4_K_M
- Lemonade
How to use MaziyarPanahi/mathstral-7B-v0.1-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull MaziyarPanahi/mathstral-7B-v0.1-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.mathstral-7B-v0.1-GGUF-Q4_K_M
List all available models
lemonade list
Update README.md
#2
by MaziyarPanahi - opened
README.md
CHANGED
|
@@ -43,4 +43,66 @@ Here is an incomplete list of clients and libraries that are known to support GG
|
|
| 43 |
|
| 44 |
## Special thanks
|
| 45 |
|
| 46 |
-
🙏 Special thanks to [Georgi Gerganov](https://github.com/ggerganov) and the whole team working on [llama.cpp](https://github.com/ggerganov/llama.cpp/) for making all of this possible.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
## Special thanks
|
| 45 |
|
| 46 |
+
🙏 Special thanks to [Georgi Gerganov](https://github.com/ggerganov) and the whole team working on [llama.cpp](https://github.com/ggerganov/llama.cpp/) for making all of this possible.
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
---
|
| 50 |
+
|
| 51 |
+
**Original README**
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
# Model Card for Mathstral-7B-v0.1
|
| 55 |
+
|
| 56 |
+
Mathstral 7B is a model specializing in mathematical and scientific tasks, based on Mistral 7B.
|
| 57 |
+
You can read more in the [official blog post](https://mistral.ai/news/mathstral/).
|
| 58 |
+
|
| 59 |
+
## Installation
|
| 60 |
+
|
| 61 |
+
It is recommended to use `mistralai/mathstral-7B-v0.1` with [mistral-inference](https://github.com/mistralai/mistral-inference)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
```
|
| 65 |
+
pip install mistral_inference>=1.2.0
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
## Download
|
| 70 |
+
|
| 71 |
+
```py
|
| 72 |
+
from huggingface_hub import snapshot_download
|
| 73 |
+
from pathlib import Path
|
| 74 |
+
|
| 75 |
+
mistral_models_path = Path.home().joinpath('mistral_models', 'mathstral-7B-v0.1')
|
| 76 |
+
mistral_models_path.mkdir(parents=True, exist_ok=True)
|
| 77 |
+
|
| 78 |
+
snapshot_download(repo_id="mistralai/mathstral-7B-v0.1", allow_patterns=["params.json", "consolidated.safetensors", "tokenizer.model.v3"], local_dir=mistral_models_path)
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
### Chat
|
| 82 |
+
|
| 83 |
+
After installing `mistral_inference`, a `mistral-demo` CLI command should be available in your environment.
|
| 84 |
+
|
| 85 |
+
```
|
| 86 |
+
mistral-chat $HOME/mistral_models/mathstral-7B-v0.1 --instruct --max_tokens 256
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
You can then start chatting with the model, *e.g.* prompt it with something like:
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
*"Albert likes to surf every week. Each surfing session lasts for 4 hours and costs $20 per hour. How much would Albert spend in 5 weeks?"*
|
| 93 |
+
|
| 94 |
+
## Evaluation
|
| 95 |
+
We evaluate Mathstral 7B and open-weight models of the similar size on industry-standard benchmarks.
|
| 96 |
+
| Benchmarks | MATH | GSM8K (8-shot) | Odyssey Math maj@16 | GRE Math maj@16 | AMC 2023 maj@16 | AIME 2024 maj@16
|
| 97 |
+
| :--- | :---: | :---: | :---: | :---: | :---: | :---: |
|
| 98 |
+
| Mathstral 7B | **56.6** | 77.1 | **37.2** | 56.9 | **42.4** | **2/30** |
|
| 99 |
+
| DeepSeek Math 7B | 44.4 | **80.6** | 27.6 | 44.6 | 28.0 | 0/30 |
|
| 100 |
+
| Llama3 8B | 28.4 | 75.4 | 24.0 | 26.2 | 34.4 | 0/30 |
|
| 101 |
+
| GLM4 9B | 50.2 | 48.8 | 18.9 | 46.2 | 36.0 | 1/30 |
|
| 102 |
+
| QWen2 7B | **56.8** | 32.7 | 24.8 | **58.5** | 35.2 | **2/30** |
|
| 103 |
+
| Gemma2 9B | 48.3 | 69.5 | 18.6 | 52.3 | 31.2 | 1/30 |
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
## The Mistral AI Team
|
| 107 |
+
|
| 108 |
+
Albert Jiang, Alexandre Sablayrolles, Alexis Tacnet, Alok Kothari, Antoine Roux, Arthur Mensch, Audrey Herblin-Stoop, Augustin Garreau, Austin Birky, Bam4d, Baptiste Bout, Baudouin de Monicault, Blanche Savary, Carole Rambaud, Caroline Feldman, Devendra Singh Chaplot, Diego de las Casas, Eleonore Arcelin, Emma Bou Hanna, Etienne Metzger, Gaspard Blanchet, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Harizo Rajaona, Henri Roussez, Hichem Sattouf, Ian Mack, Jean-Malo Delignon, Jessica Chudnovsky, Justus Murke, Kartik Khandelwal, Lawrence Stewart, Louis Martin, Louis Ternon, Lucile Saulnier, Lélio Renard Lavaud, Margaret Jennings, Marie Pellat, Marie Torelli, Marie-Anne Lachaux, Marjorie Janiewicz, Mickaël Seznec, Nicolas Schuhl, Niklas Muhs, Olivier de Garrigues, Patrick von Platen, Paul Jacob, Pauline Buche, Pavan Kumar Reddy, Perry Savas, Pierre Stock, Romain Sauvestre, Sagar Vaze, Sandeep Subramanian, Saurabh Garg, Sophia Yang, Szymon Antoniak, Teven Le Scao, Thibault Schueller, Thibaut Lavril, Thomas Wang, Théophile Gervet, Timothée Lacroix, Valera Nemychnikova, Wendy Shang, William El Sayed, William Marshall
|