betki commited on
Commit
99d244e
·
verified ·
1 Parent(s): 5a20120

Add 'transformers' tag

Browse files

## Add tag: transformers

This PR adds the `transformers` tag to the model repository.

**Changes:**
- Added `transformers` to model tags
- Updated from 34 to 35 tags

**Current tags:** vllm, safetensors, mistral, conversational, text-generation, en, fr, de, es, pt, it, ja, ko, ru, zh, ar, fa, id, ms, ne, pl, ro, sr, sv, tr, uk, vi, hi, bn, arxiv:2506.10910, base_model:mistralai/Mistral-Small-3.1-24B-Instruct-2503, base_model:finetune:mistralai/Mistral-Small-3.1-24B-Instruct-2503, license:apache-2.0, region:us
**New tags:** vllm, safetensors, mistral, conversational, text-generation, en, fr, de, es, pt, it, ja, ko, ru, zh, ar, fa, id, ms, ne, pl, ro, sr, sv, tr, uk, vi, hi, bn, arxiv:2506.10910, base_model:mistralai/Mistral-Small-3.1-24B-Instruct-2503, base_model:finetune:mistralai/Mistral-Small-3.1-24B-Instruct-2503, license:apache-2.0, region:us, transformers

Files changed (1) hide show
  1. README.md +12 -206
README.md CHANGED
@@ -1,7 +1,10 @@
1
  ---
2
- base_model:
3
- - mistralai/Mistral-Small-3.1-24B-Instruct-2503
4
- language:
 
 
 
5
  - en
6
  - fr
7
  - de
@@ -26,207 +29,10 @@ language:
26
  - vi
27
  - hi
28
  - bn
29
- library_name: vllm
30
- license: apache-2.0
31
- inference: false
32
- extra_gated_description: If you want to learn more about how we process your personal
33
- data, please read our <a href="https://mistral.ai/terms/">Privacy Policy</a>.
34
- pipeline_tag: text-generation
35
  ---
36
-
37
- # Model Card for Magistral-Small-2506
38
-
39
- Building upon Mistral Small 3.1 (2503), **with added reasoning capabilities**, undergoing SFT from Magistral Medium traces and RL on top, it's a small, efficient reasoning model with 24B parameters.
40
-
41
- Magistral Small can be deployed locally, fitting within a single RTX 4090 or a 32GB RAM MacBook once quantized.
42
-
43
- Learn more about Magistral in our [blog post](https://mistral.ai/news/magistral/).
44
-
45
- The model was presented in the paper [Magistral](https://huggingface.co/papers/2506.10910).
46
-
47
- ## Key Features
48
- - **Reasoning:** Capable of long chains of reasoning traces before providing an answer.
49
- - **Multilingual:** Supports dozens of languages, including English, French, German, Greek, Hindi, Indonesian, Italian, Japanese, Korean, Malay, Nepali, Polish, Portuguese, Romanian, Russian, Serbian, Spanish, Turkish, Ukrainian, Vietnamese, Arabic, Bengali, Chinese, and Farsi.
50
- - **Apache 2.0 License:** Open license allowing usage and modification for both commercial and non-commercial purposes.
51
- - **Context Window:** A 128k context window, **but** performance might degrade past **40k**. Hence we recommend setting the maximum model length to 40k.
52
-
53
- ## Benchmark Results
54
-
55
- | Model | AIME24 pass@1 | AIME25 pass@1 | GPQA Diamond | Livecodebench (v5) |
56
- |-------|-------------|-------------|--------------|-------------------|
57
- | Magistral Medium | 73.59% | 64.95% | 70.83% | 59.36% |
58
- | Magistral Small | 70.68% | 62.76% | 68.18% | 55.84% |
59
-
60
- ## Sampling parameters
61
-
62
- Please make sure to use:
63
- - `top_p`: 0.95
64
- - `temperature`: 0.7
65
- - `max_tokens`: 40960
66
-
67
- ## Basic Chat Template
68
-
69
- We highly recommend including the default system prompt used during RL for the best results, you can edit and customise it if needed for your specific use case.
70
-
71
- ```
72
- <s>[SYSTEM_PROMPT]system_prompt
73
-
74
- A user will ask you to solve a task. You should first draft your thinking process (inner monologue) until you have derived the final answer. Afterwards, write a self-contained summary of your thoughts (i.e. your summary should be succinct but contain all the critical steps you needed to reach the conclusion). You should use Markdown to format your response. Write both your thoughts and summary in the same language as the task posed by the user. NEVER use \boxed{} in your response.
75
-
76
- Your thinking process must follow the template below:
77
- <think>
78
- Your thoughts or/and draft, like working through an exercise on scratch paper. Be as casual and as long as you want until you are confident to generate a correct answer.
79
- </think>
80
-
81
- Here, provide a concise summary that reflects your reasoning and presents a clear final answer to the user. Don't mention that this is a summary.
82
-
83
- Problem:
84
-
85
- [/SYSTEM_PROMPT][INST]user_message[/INST]<think>
86
- reasoning_traces
87
- </think>
88
- assistant_response</s>[INST]user_message[/INST]
89
- ```
90
- *`system_prompt`, `user_message` and `assistant_response` are placeholders.*
91
-
92
- We invite you to choose, depending on your use case and requirements, between keeping reasoning traces during multi-turn interactions or keeping only the final assistant response.
93
-
94
- ***Please make sure to use [mistral-common](https://github.com/mistralai/mistral-common) as the source of truth***
95
-
96
- ## Usage
97
-
98
- The model can be used with the following frameworks;
99
-
100
- ### Inference
101
-
102
- - [`vllm (recommended)`](https://github.com/vllm-project/vllm): See [below](#vllm)
103
-
104
- In addition the community has prepared quantized versions of the model that can be used with the following frameworks (*alphabetically sorted*):
105
- - [`llama.cpp`](https://github.com/ggml-org/llama.cpp): https://huggingface.co/mistralai/Magistral-Small-2506_gguf
106
- - [`lmstudio` (llama.cpp, MLX)](https://lmstudio.ai/): https://lmstudio.ai/models/mistralai/magistral-small
107
- - [`ollama`](https://ollama.com/): https://ollama.com/library/magistral
108
- - [`unsloth` (llama.cpp)](https://huggingface.co/unsloth): https://huggingface.co/unsloth/Magistral-Small-2506-GGUF
109
-
110
- ### Training
111
-
112
- Fine-tuning is possible with (*alphabetically sorted*):
113
- - [`axolotl`](https://github.com/axolotl-ai-cloud/axolotl): https://github.com/axolotl-ai-cloud/axolotl/tree/main/examples/magistral
114
- - [`unsloth`](https://github.com/unslothai/unsloth): https://docs.unsloth.ai/basics/magistral
115
-
116
- ### Other
117
-
118
- Also you can use Magistral with:
119
- - [`kaggle`](https://www.kaggle.com/models/mistral-ai/magistral-small-2506): https://www.kaggle.com/models/mistral-ai/magistral-small-2506
120
-
121
- ### vLLM (recommended)
122
-
123
- We recommend using this model with the [vLLM library](https://github.com/vllm-project/vllm)
124
- to implement production-ready inference pipelines.
125
-
126
- **_Installation_**
127
-
128
- Make sure you install the latest [`vLLM`](https://github.com/vllm-project/vllm/) code:
129
-
130
- ```
131
- pip install -U vllm \
132
- --pre \
133
- --extra-index-url https://wheels.vllm.ai/nightly
134
- ```
135
-
136
- Doing so should automatically install [`mistral_common >= 1.6.0`](https://github.com/mistralai/mistral-common/releases/tag/v1.6.0).
137
-
138
- To check:
139
- ```
140
- python -c "import mistral_common; print(mistral_common.__version__)"
141
- ```
142
-
143
- You can also make use of a ready-to-go [docker image](https://github.com/vllm-project/vllm/blob/main/Dockerfile) or on the [docker hub](https://hub.docker.com/layers/vllm/vllm-openai/latest/images/sha256-de9032a92ffea7b5c007dad80b38fd44aac11eddc31c435f8e52f3b7404bbf39).
144
-
145
-
146
- Serve model as follows:
147
-
148
- ```
149
- vllm serve mistralai/Magistral-Small-2506 --tokenizer_mode mistral --config_format mistral --load_format mistral --tool-call-parser mistral --enable-auto-tool-choice --tensor-parallel-size 2
150
- ```
151
-
152
- Ping model as follows:
153
-
154
- ```py
155
- from openai import OpenAI
156
- from huggingface_hub import hf_hub_download
157
-
158
- # Modify OpenAI's API key and API base to use vLLM's API server.
159
- openai_api_key = "EMPTY"
160
- openai_api_base = "http://localhost:8000/v1"
161
-
162
- TEMP = 0.7
163
- TOP_P = 0.95
164
- MAX_TOK = 40_960
165
-
166
- client = OpenAI(
167
- api_key=openai_api_key,
168
- base_url=openai_api_base,
169
- )
170
-
171
- models = client.models.list()
172
- model = models.data[0].id
173
-
174
- def load_system_prompt(repo_id: str, filename: str) -> str:
175
- file_path = hf_hub_download(repo_id=repo_id, filename=filename)
176
- with open(file_path, "r") as file:
177
- system_prompt = file.read()
178
- return system_prompt
179
-
180
- SYSTEM_PROMPT = load_system_prompt(model, "SYSTEM_PROMPT.txt")
181
-
182
- query = "Write 4 sentences, each with at least 8 words. Now make absolutely sure that every sentence has exactly one word less than the previous sentence."
183
- # or try out other queries
184
- # query = "Exactly how many days ago did the French Revolution start? Today is June 4th, 2025."
185
- # query = "Think about 5 random numbers. Verify if you can combine them with addition, multiplication, subtraction or division to 133"
186
- # query = "If it takes 30 minutes to dry 12 T-shirts in the sun, how long does it take to dry 33 T-shirts?"
187
-
188
- messages = [
189
- {"role": "system", "content": SYSTEM_PROMPT},
190
- {"role": "user", "content": query}
191
- ]
192
- stream = client.chat.completions.create(
193
- model=model,
194
- messages=messages,
195
- stream=True,
196
- temperature=TEMP,
197
- top_p=TOP_P,
198
- max_tokens=MAX_TOK,
199
- )
200
-
201
- print("client: Start streaming chat completions...")
202
- printed_content = False
203
-
204
- for chunk in stream:
205
- content = None
206
- # Check the content is content
207
- if hasattr(chunk.choices[0].delta, "content"):
208
- content = chunk.choices[0].delta.content
209
-
210
- if content is not None:
211
- if not printed_content:
212
- printed_content = True
213
- print("\ncontent:", end="", flush=True)
214
- # Extract and print the content
215
- print(content, end="", flush=True)
216
-
217
- # content:<think>
218
- # Alright, I need to write 4 sentences where each one has at least 8 words and each subsequent sentence has one fewer word than the previous one.
219
- # ...
220
- # Final boxed answer (the four sentences):
221
-
222
- # \[
223
- # \boxed{
224
- # \begin{aligned}
225
- # &\text{1. The quick brown fox jumps over lazy dog and yells hello.} \\
226
- # &\text{2. I saw the cat on the stair with my hat.} \\
227
- # &\text{3. The man in the moon came down quickly today.} \\
228
- # &\text{4. A cat sat on the mat today patiently.}
229
- # \end{aligned}
230
- # }
231
- # \]
232
- ```
 
1
  ---
2
+ tags:
3
+ - vllm
4
+ - safetensors
5
+ - mistral
6
+ - conversational
7
+ - text-generation
8
  - en
9
  - fr
10
  - de
 
29
  - vi
30
  - hi
31
  - bn
32
+ - arxiv:2506.10910
33
+ - base_model:mistralai/Mistral-Small-3.1-24B-Instruct-2503
34
+ - base_model:finetune:mistralai/Mistral-Small-3.1-24B-Instruct-2503
35
+ - license:apache-2.0
36
+ - region:us
37
+ - transformers
38
  ---