Files changed (4) hide show
  1. .gitattributes +0 -1
  2. README.md +155 -315
  3. SYSTEM_PROMPT.txt +1 -1
  4. params.json +1 -5
.gitattributes CHANGED
@@ -33,4 +33,3 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
- tokenizer.json filter=lfs diff=lfs merge=lfs -text
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
README.md CHANGED
@@ -1,5 +1,4 @@
1
  ---
2
- library_name: vllm
3
  language:
4
  - en
5
  - fr
@@ -13,218 +12,94 @@ language:
13
  - ko
14
  license: other
15
  license_name: mrl
 
16
  license_link: https://mistral.ai/licenses/MRL-0.1.md
17
- extra_gated_prompt: >-
18
  # Mistral AI Research License
19
 
20
- If You want to use a Mistral Model, a Derivative or an Output for any purpose
21
- that is not expressly authorized under this Agreement, You must request a
22
- license from Mistral AI, which Mistral AI may grant to You in Mistral AI's
23
- sole discretion. To discuss such a license, please contact Mistral AI via the
24
- website contact form: https://mistral.ai/contact/
25
 
26
  ## 1. Scope and acceptance
27
 
28
- **1.1. Scope of the Agreement.** This Agreement applies to any use,
29
- modification, or Distribution of any Mistral Model by You, regardless of the
30
- source You obtained a copy of such Mistral Model.
31
 
32
- **1.2. Acceptance.** By accessing, using, modifying, Distributing a Mistral
33
- Model, or by creating, using or distributing a Derivative of the Mistral
34
- Model, You agree to be bound by this Agreement.
35
 
36
- **1.3. Acceptance on behalf of a third-party.** If You accept this Agreement
37
- on behalf of Your employer or another person or entity, You warrant and
38
- represent that You have the authority to act and accept this Agreement on
39
- their behalf. In such a case, the word "You" in this Agreement will refer to
40
- Your employer or such other person or entity.
41
 
42
  ## 2. License
43
 
44
- **2.1. Grant of rights**. Subject to Section 3 below, Mistral AI hereby
45
- grants You a non-exclusive, royalty-free, worldwide, non-sublicensable,
46
- non-transferable, limited license to use, copy, modify, and Distribute under
47
- the conditions provided in Section 2.2 below, the Mistral Model and any
48
- Derivatives made by or for Mistral AI and to create Derivatives of the Mistral
49
- Model.
50
-
51
- **2.2. Distribution of Mistral Model and Derivatives made by or for Mistral
52
- AI.** Subject to Section 3 below, You may Distribute copies of the Mistral
53
- Model and/or Derivatives made by or for Mistral AI, under the following
54
- conditions: You must make available a copy of this Agreement to third-party
55
- recipients of the Mistral Models and/or Derivatives made by or for Mistral AI
56
- you Distribute, it being specified that any rights to use the Mistral Models
57
- and/or Derivatives made by or for Mistral AI shall be directly granted by
58
- Mistral AI to said third-party recipients pursuant to the Mistral AI Research
59
- License agreement executed between these parties; You must retain in all
60
- copies of the Mistral Models the following attribution notice within a
61
- "Notice" text file distributed as part of such copies: "Licensed by Mistral AI
62
- under the Mistral AI Research License".
63
-
64
- **2.3. Distribution of Derivatives made by or for You.** Subject to Section 3
65
- below, You may Distribute any Derivatives made by or for You under additional
66
- or different terms and conditions, provided that: In any event, the use and
67
- modification of Mistral Model and/or Derivatives made by or for Mistral AI
68
- shall remain governed by the terms and conditions of this Agreement; You
69
- include in any such Derivatives made by or for You prominent notices stating
70
- that You modified the concerned Mistral Model; and Any terms and conditions
71
- You impose on any third-party recipients relating to Derivatives made by or
72
- for You shall neither limit such third-party recipients' use of the Mistral
73
- Model or any Derivatives made by or for Mistral AI in accordance with the
74
- Mistral AI Research License nor conflict with any of its terms and conditions.
75
 
76
  ## 3. Limitations
77
 
78
- **3.1. Misrepresentation.** You must not misrepresent or imply, through any
79
- means, that the Derivatives made by or for You and/or any modified version of
80
- the Mistral Model You Distribute under your name and responsibility is an
81
- official product of Mistral AI or has been endorsed, approved or validated by
82
- Mistral AI, unless You are authorized by Us to do so in writing.
83
 
84
- **3.2. Usage Limitation.** You shall only use the Mistral Models, Derivatives
85
- (whether or not created by Mistral AI) and Outputs for Research Purposes.
86
 
87
  ## 4. Intellectual Property
88
 
89
- **4.1. Trademarks.** No trademark licenses are granted under this Agreement,
90
- and in connection with the Mistral Models, You may not use any name or mark
91
- owned by or associated with Mistral AI or any of its affiliates, except (i) as
92
- required for reasonable and customary use in describing and Distributing the
93
- Mistral Models and Derivatives made by or for Mistral AI and (ii) for
94
- attribution purposes as required by this Agreement.
95
 
96
- **4.2. Outputs.** We claim no ownership rights in and to the Outputs. You are
97
- solely responsible for the Outputs You generate and their subsequent uses in
98
- accordance with this Agreement. Any Outputs shall be subject to the
99
- restrictions set out in Section 3 of this Agreement.
100
 
101
- **4.3. Derivatives.** By entering into this Agreement, You accept that any
102
- Derivatives that You may create or that may be created for You shall be
103
- subject to the restrictions set out in Section 3 of this Agreement.
104
 
105
  ## 5. Liability
106
 
107
- **5.1. Limitation of liability.** In no event, unless required by applicable
108
- law (such as deliberate and grossly negligent acts) or agreed to in writing,
109
- shall Mistral AI be liable to You for damages, including any direct, indirect,
110
- special, incidental, or consequential damages of any character arising as a
111
- result of this Agreement or out of the use or inability to use the Mistral
112
- Models and Derivatives (including but not limited to damages for loss of data,
113
- loss of goodwill, loss of expected profit or savings, work stoppage, computer
114
- failure or malfunction, or any damage caused by malware or security breaches),
115
- even if Mistral AI has been advised of the possibility of such damages.
116
 
117
- **5.2. Indemnification.** You agree to indemnify and hold harmless Mistral AI
118
- from and against any claims, damages, or losses arising out of or related to
119
- Your use or Distribution of the Mistral Models and Derivatives.
120
 
121
  ## 6. Warranty
122
 
123
- **6.1. Disclaimer.** Unless required by applicable law or prior agreed to by
124
- Mistral AI in writing, Mistral AI provides the Mistral Models and Derivatives
125
- on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
126
- express or implied, including, without limitation, any warranties or
127
- conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
128
- PARTICULAR PURPOSE. Mistral AI does not represent nor warrant that the Mistral
129
- Models and Derivatives will be error-free, meet Your or any third party's
130
- requirements, be secure or will allow You or any third party to achieve any
131
- kind of result or generate any kind of content. You are solely responsible for
132
- determining the appropriateness of using or Distributing the Mistral Models
133
- and Derivatives and assume any risks associated with Your exercise of rights
134
- under this Agreement.
135
 
136
  ## 7. Termination
137
 
138
- **7.1. Term.** This Agreement is effective as of the date of your acceptance
139
- of this Agreement or access to the concerned Mistral Models or Derivatives and
140
- will continue until terminated in accordance with the following terms.
141
-
142
- **7.2. Termination.** Mistral AI may terminate this Agreement at any time if
143
- You are in breach of this Agreement. Upon termination of this Agreement, You
144
- must cease to use all Mistral Models and Derivatives and shall permanently
145
- delete any copy thereof. The following provisions, in their relevant parts,
146
- will survive any termination or expiration of this Agreement, each for the
147
- duration necessary to achieve its own intended purpose (e.g. the liability
148
- provision will survive until the end of the applicable limitation
149
- period):Sections 5 (Liability), 6(Warranty), 7 (Termination) and 8 (General
150
- Provisions).
151
-
152
- **7.3. Litigation.** If You initiate any legal action or proceedings against
153
- Us or any other entity (including a cross-claim or counterclaim in a lawsuit),
154
- alleging that the Model or a Derivative, or any part thereof, infringe upon
155
- intellectual property or other rights owned or licensable by You, then any
156
- licenses granted to You under this Agreement will immediately terminate as of
157
- the date such legal action or claim is filed or initiated.
158
 
159
  ## 8. General provisions
160
 
161
- **8.1. Governing laws.** This Agreement will be governed by the laws of
162
- France, without regard to choice of law principles, and the UN Convention on
163
- Contracts for the International Sale of Goods does not apply to this
164
- Agreement.
165
 
166
- **8.2. Competent jurisdiction.** The courts of Paris shall have exclusive
167
- jurisdiction of any dispute arising out of this Agreement.
168
 
169
- **8.3. Severability.** If any provision of this Agreement is held to be
170
- invalid, illegal or unenforceable, the remaining provisions shall be
171
- unaffected thereby and remain valid as if such provision had not been set
172
- forth herein.
173
 
174
  ## 9. Definitions
175
 
176
- "Agreement": means this Mistral AI Research License agreement governing the
177
- access, use, and Distribution of the Mistral Models, Derivatives and Outputs.
178
-
179
- "Derivative": means any (i) modified version of the Mistral Model (including
180
- but not limited to any customized or fine-tuned version thereof), (ii) work
181
- based on the Mistral Model, or (iii) any other derivative work thereof.
182
-
183
- "Distribution", "Distributing", "Distribute" or "Distributed": means
184
- supplying, providing or making available, by any means, a copy of the Mistral
185
- Models and/or the Derivatives as the case may be, subject to Section 3 of this
186
- Agreement.
187
-
188
- "Mistral AI", "We" or "Us": means Mistral AI, a French société par actions
189
- simplifiée registered in the Paris commercial registry under the number 952
190
- 418 325, and having its registered seat at 15, rue des Halles, 75001 Paris.
191
-
192
- "Mistral Model": means the foundational large language model(s), and its
193
- elements which include algorithms, software, instructed checkpoints,
194
- parameters, source code (inference code, evaluation code and, if applicable,
195
- fine-tuning code) and any other elements associated thereto made available by
196
- Mistral AI under this Agreement, including, if any, the technical
197
- documentation, manuals and instructions for the use and operation thereof.
198
-
199
- "Research Purposes": means any use of a Mistral Model, Derivative, or Output
200
- that is solely for (a) personal, scientific or academic research, and (b) for
201
- non-profit and non-commercial purposes, and not directly or indirectly
202
- connected to any commercial activities or business operations. For
203
- illustration purposes, Research Purposes does not include (1) any usage of the
204
- Mistral Model, Derivative or Output by individuals or contractors employed in
205
- or engaged by companies in the context of (a) their daily tasks, or (b) any
206
- activity (including but not limited to any testing or proof-of-concept) that
207
- is intended to generate revenue, nor (2) any Distribution by a commercial
208
- entity of the Mistral Model, Derivative or Output whether in return for
209
- payment or free of charge, in any medium or form, including but not limited to
210
- through a hosted or managed service (e.g. SaaS, cloud instances, etc.), or
211
- behind a software layer.
212
-
213
- "Outputs": means any content generated by the operation of the Mistral Models
214
- or the Derivatives from a prompt (i.e., text instructions) provided by users.
215
- For the avoidance of doubt, Outputs do not include any components of a Mistral
216
- Models, such as any fine-tuned versions of the Mistral Models, the weights, or
217
- parameters.
218
-
219
- "You": means the individual or entity entering into this Agreement with
220
- Mistral AI.
221
-
222
-
223
- *Mistral AI processes your personal data below to provide the model and
224
- enforce its license. If you are affiliated with a commercial entity, we may
225
- also send you communications about our models. For more information on your
226
- rights and data handling, please see our <a
227
- href="https://mistral.ai/terms/">privacy policy</a>.*
228
  extra_gated_fields:
229
  First Name: text
230
  Last Name: text
@@ -235,35 +110,26 @@ extra_gated_fields:
235
  I understand that if I am a commercial entity, I am not permitted to use or distribute the model internally or externally, or expose it in my own offerings without a commercial license: checkbox
236
  I understand that if I upload the model, or any derivative version, on any platform, I must include the Mistral Research License: checkbox
237
  I understand that for commercial use of the model, I can contact Mistral or use the Mistral AI API on la Plateforme or any of our cloud provider partners: checkbox
238
- By clicking Submit below I accept the terms of the license and acknowledge that the information I provide will be collected stored processed and shared in accordance with the Mistral Privacy Policy: checkbox
 
 
 
239
  geo: ip_location
240
  extra_gated_description: >-
241
- Mistral AI processes your personal data below to provide the model and enforce
242
- its license. If you are affiliated with a commercial entity, we may also send
243
- you communications about our models. For more information on your rights and
244
- data handling, please see our <a href="https://mistral.ai/terms/">privacy
245
- policy</a>.
246
  extra_gated_button_content: Submit
247
- inference: false
248
- tags:
249
- - mistral-common
250
  ---
251
 
252
  # Model Card for Pixtral-Large-Instruct-2411
253
 
254
  Pixtral-Large-Instruct-2411 is a 124B multimodal model built on top of Mistral Large 2, i.e., [Mistral-Large-Instruct-2407](https://huggingface.co/mistralai/Mistral-Large-Instruct-2407). Pixtral Large is the second model in our multimodal family and demonstrates frontier-level image understanding. Particularly, the model is able to understand documents, charts and natural images, while maintaining the leading text-only understanding of Mistral Large 2.
255
 
256
- For more details about this model please refer to the [Pixtral Large blog post](https://mistral.ai/news/pixtral-large/) and the [Pixtral 12B blog post](https://mistral.ai/news/pixtral-12b/).
257
-
258
-
259
- > [!IMPORTANT]
260
- > ❗
261
- > The Transformers implementation is not yet working (see [here](https://huggingface.co/mistralai/Pixtral-Large-Instruct-2411/discussions/3#673b8bfe55cb1761c8d50ce2)), please use the vLLM implementation
262
- > as shown below.
263
 
264
  ## Key features
265
  - Frontier-class multimodal performance
266
- - State-of-the-art on MathVista, DocVQA, VQAv2
267
  - Extends Mistral Large 2 without compromising text performance
268
  - 123B multimodal decoder, 1B parameter vision encoder
269
  - 128K context window: fits minimum of 30 high-resolution images
@@ -300,15 +166,10 @@ To achieve optimal results, we recommend always including a system prompt that c
300
 
301
  | Model | MathVista (CoT) | MMMU (CoT) | ChartQA (CoT) | DocVQA (ANLS) | VQAv2 (VQA Match) | AI2D (BBox) | MM MT-Bench |
302
  |:----------------------------:|:---------------:|:----------:|:-------------:|:--------------:|:-----------------:|:-----------:|:-----------:|
303
- | **Pixtral Large (124B)** | **<u>69.4</u>** | 64.0 | 88.1 | **<u>93.3</u>**| **<u>80.9</u>** | 93.8 | **<u>7.4</u>**|
304
  | Gemini-1.5 Pro (measured) | 67.8 | 66.3 | 83.8 | 92.3 | 70.6 | **<u>94.6</u>**| 6.8 |
305
- | GPT-4o (measured) | 65.4 | **<u>68.6</u>**| 85.2 | 88.5 | 76.4 | 93.2 | 6.7 |
306
  | Claude-3.5 Sonnet (measured) | 67.1 | 68.4 | **<u>89.1</u>**| 88.6 | 69.5 | 76.9 | 7.3 |
307
- | Llama-3.2 90B (measured) | 49.1 | 53.7 | 70.8 | 85.7 | 67.0 | - | 5.5 |
308
-
309
- Specific model versions evaluated: Claude-3.5 Sonnet (new) [Oct 24], Gemini-1.5 Pro (002) [Sep 24], GPT-4o (2024-08-06) [Aug 24].
310
-
311
- See [mistral-evals](https://github.com/mistralai/mistral-evals) for open-source MM MT-Bench evaluation scripts.
312
 
313
  ## Usage
314
 
@@ -323,55 +184,98 @@ to implement production-ready inference pipelines with Pixtral-Large-Instruct-24
323
 
324
  **_Installation_**
325
 
326
- Make sure you install [`vLLM >= v0.6.4.post1`](https://github.com/vllm-project/vllm/releases/tag/v0.6.4.post1):
327
 
328
  ```
329
  pip install --upgrade vllm
330
  ```
331
 
332
- Also make sure you have [`mistral_common >= 1.5.0`](https://github.com/mistralai/mistral-common/releases/tag/v1.5.0) installed:
333
 
334
  ```
335
  pip install --upgrade mistral_common
336
  ```
337
 
338
- 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-55a88146a4da0b6e193431b5b1d3492dfd7bebdc16919df4d031273e85a6157c?context=explore).
339
 
 
 
 
 
 
 
340
 
341
- #### Server (Image)
342
- We recommend to use Pixtral-Large-Instruct-2411 in a server/client setting.
343
 
344
- 1. Spin up a server:
 
 
 
 
 
 
 
345
 
346
- ```
347
- vllm serve mistralai/Pixtral-Large-Instruct-2411 --config-format mistral --load-format mistral --tokenizer_mode mistral --limit_mm_per_prompt 'image=10' --tensor-parallel-size 8
348
- ```
349
 
350
- 2. And ping the client:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
 
 
352
  ```py
353
- import requests
354
- import json
355
  from huggingface_hub import hf_hub_download
356
  from datetime import datetime, timedelta
357
 
358
- url = "http://<your-server-url>:8000/v1/chat/completions"
359
- headers = {"Content-Type": "application/json", "Authorization": "Bearer token"}
360
-
361
- model = "mistralai/Pixtral-Large-Instruct-2411"
362
-
363
 
364
  def load_system_prompt(repo_id: str, filename: str) -> str:
365
  file_path = hf_hub_download(repo_id=repo_id, filename=filename)
366
- with open(file_path, "r") as file:
367
  system_prompt = file.read()
368
- today = datetime.today().strftime("%Y-%m-%d")
369
- yesterday = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
370
  model_name = repo_id.split("/")[-1]
371
  return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
372
 
373
-
374
- SYSTEM_PROMPT = load_system_prompt(model, "SYSTEM_PROMPT.txt")
375
 
376
  image_url = "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/europe.png"
377
 
@@ -389,32 +293,26 @@ messages = [
389
  },
390
  ]
391
 
392
- data = {"model": model, "messages": messages}
393
 
394
- response = requests.post(url, headers=headers, data=json.dumps(data))
395
- print(response.json()["choices"][0]["message"]["content"])
396
- # Determining which country has the "best" food can be subjective and depends on personal preferences. However, based on popular culinary reputations, here are some countries known for their cuisine:
397
 
398
- #1. **Italy** (Brown) - Known for its pasta, pizza, and diverse regional dishes.
399
- # - City: Milan
400
 
401
- #2. **France** (Dark Brown) - Renowned for its fine dining, pastries, and wine.
402
- # - City: Lyon
403
 
404
- #3. **Spain** (Yellow) - Famous for tapas, paella, and a variety of seafood dishes.
405
- # - City: Barcelona
406
 
407
- #4. **Greece** (Yellow) - Known for its Mediterranean cuisine, including moussaka, souvlaki, and fresh seafood.
408
- # - City: Thessaloniki
409
 
410
- #These rankings are based on general culinary reputations and can vary widely depending on individual tastes.
 
411
  ```
412
 
413
- #### Server (Text-only)
414
-
415
- You can also ping the client with a text-only example. The following example
416
- shows how the system prompt can be used to make sure the model always knows
417
- the current date.
418
 
419
  ```py
420
  import requests
@@ -422,7 +320,7 @@ import json
422
  from huggingface_hub import hf_hub_download
423
  from datetime import datetime, timedelta
424
 
425
- url = "http://<your-server-url>:8000/v1/chat/completions"
426
  headers = {"Content-Type": "application/json", "Authorization": "Bearer token"}
427
 
428
  model = "mistralai/Pixtral-Large-Instruct-2411"
@@ -442,76 +340,6 @@ SYSTEM_PROMPT = load_system_prompt(model, "SYSTEM_PROMPT.txt")
442
 
443
  image_url = "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/europe.png"
444
 
445
- messages = [
446
- {"role": "system", "content": SYSTEM_PROMPT},
447
- {
448
- "role": "user",
449
- "content": "Without browsing the web, how many days ago was Mistral founded?"
450
- },
451
- ]
452
-
453
- data = {"model": model, "messages": messages}
454
-
455
- response = requests.post(url, headers=headers, data=json.dumps(data))
456
- print(response.json()["choices"][0]["message"]["content"])
457
- # Mistral AI was founded in April 2023. Since the current date is November 18, 2024, we can calculate the number of days between April 2023 and November 18, 2024.
458
-
459
- #First, calculate the days from April 2023 to the end of 2023:
460
- #- April: 27 days (30 - 3)
461
- #- May: 31 days
462
- #- June: 30 days
463
- #- July: 31 days
464
- #- August: 31 days
465
- #- September: 30 days
466
- #- October: 31 days
467
- #- November: 30 days
468
- #- December: 31 days
469
-
470
- #Total days from April 2023 to December 31, 2023: 27 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 = 272 days
471
-
472
- #Next, calculate the days from January 1, 2024, to November 18, 2024:
473
- #- January: 31 days
474
- #- February: 29 days (2024 is a leap year)
475
- #- March: 31 days
476
- #- April: 30 days
477
- #- May: 31 days
478
- #- June: 30 days
479
- #- July: 31 days
480
- #- August: 31 days
481
- #- September: 30 days
482
- #- October: 31 days
483
- #- November: 18 days
484
-
485
- #Total days from January 1, 2024, to November 18, 2024: 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 18 = 323 days
486
-
487
- #Adding the two periods together:
488
- #272 days (from April 2023 to December 2023) + 323 days (from January 2024 to November 18, 2024) = 595 days
489
-
490
- #Therefore, Mistral AI was founded 595 days ago from November 18, 2024.
491
- ```
492
-
493
- #### Offline Example
494
- ```py
495
- from vllm import LLM
496
- from vllm.sampling_params import SamplingParams
497
- from huggingface_hub import hf_hub_download
498
- from datetime import datetime, timedelta
499
-
500
- model_name = "mistralai/Pixtral-Large-Instruct-2411"
501
-
502
- def load_system_prompt(repo_id: str, filename: str) -> str:
503
- file_path = hf_hub_download(repo_id=repo_id, filename=filename)
504
- with open(file_path, 'r') as file:
505
- system_prompt = file.read()
506
- today = datetime.today().strftime('%Y-%m-%d')
507
- yesterday = (datetime.today() - timedelta(days=1)).strftime('%Y-%m-%d')
508
- model_name = repo_id.split("/")[-1]
509
- return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
510
-
511
- SYSTEM_PROMPT = load_system_prompt(model_name, "SYSTEM_PROMPT.txt")
512
-
513
- image_url = "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/europe.png"
514
-
515
  messages = [
516
  {"role": "system", "content": SYSTEM_PROMPT},
517
  {
@@ -526,15 +354,27 @@ messages = [
526
  },
527
  ]
528
 
529
- sampling_params = SamplingParams(max_tokens=512)
530
 
531
- # note that running this model on GPU requires over 300 GB of GPU RAM
532
- llm = LLM(model=model_name, config_format="mistral", load_format="mistral", tokenizer_mode="mistral", tensor_parallel_size=8, limit_mm_per_prompt={"image": 4})
 
533
 
534
- outputs = llm.chat(messages, sampling_params=sampling_params)
 
535
 
536
- print(outputs[0].outputs[0].text)
 
 
 
 
 
 
 
 
 
537
  ```
 
538
 
539
  ## The Mistral AI Team
540
 
 
1
  ---
 
2
  language:
3
  - en
4
  - fr
 
12
  - ko
13
  license: other
14
  license_name: mrl
15
+ inference: false
16
  license_link: https://mistral.ai/licenses/MRL-0.1.md
17
+ extra_gated_prompt: >-
18
  # Mistral AI Research License
19
 
20
+ If You want to use a Mistral Model, a Derivative or an Output for any purpose that is not expressly authorized under this Agreement, You must request a license from Mistral AI, which Mistral AI may grant to You in Mistral AI's sole discretion. To discuss such a license, please contact Mistral AI via the website contact form: https://mistral.ai/contact/
 
 
 
 
21
 
22
  ## 1. Scope and acceptance
23
 
24
+ **1.1. Scope of the Agreement.** This Agreement applies to any use, modification, or Distribution of any Mistral Model by You, regardless of the source You obtained a copy of such Mistral Model.
 
 
25
 
26
+ **1.2. Acceptance.** By accessing, using, modifying, Distributing a Mistral Model, or by creating, using or distributing a Derivative of the Mistral Model, You agree to be bound by this Agreement.
 
 
27
 
28
+ **1.3. Acceptance on behalf of a third-party.** If You accept this Agreement on behalf of Your employer or another person or entity, You warrant and represent that You have the authority to act and accept this Agreement on their behalf. In such a case, the word "You" in this Agreement will refer to Your employer or such other person or entity.
 
 
 
 
29
 
30
  ## 2. License
31
 
32
+ **2.1. Grant of rights**. Subject to Section 3 below, Mistral AI hereby grants You a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable, limited license to use, copy, modify, and Distribute under the conditions provided in Section 2.2 below, the Mistral Model and any Derivatives made by or for Mistral AI and to create Derivatives of the Mistral Model.
33
+
34
+ **2.2. Distribution of Mistral Model and Derivatives made by or for Mistral AI.** Subject to Section 3 below, You may Distribute copies of the Mistral Model and/or Derivatives made by or for Mistral AI, under the following conditions:
35
+ You must make available a copy of this Agreement to third-party recipients of the Mistral Models and/or Derivatives made by or for Mistral AI you Distribute, it being specified that any rights to use the Mistral Models and/or Derivatives made by or for Mistral AI shall be directly granted by Mistral AI to said third-party recipients pursuant to the Mistral AI Research License agreement executed between these parties;
36
+ You must retain in all copies of the Mistral Models the following attribution notice within a "Notice" text file distributed as part of such copies: "Licensed by Mistral AI under the Mistral AI Research License".
37
+
38
+ **2.3. Distribution of Derivatives made by or for You.** Subject to Section 3 below, You may Distribute any Derivatives made by or for You under additional or different terms and conditions, provided that:
39
+ In any event, the use and modification of Mistral Model and/or Derivatives made by or for Mistral AI shall remain governed by the terms and conditions of this Agreement;
40
+ You include in any such Derivatives made by or for You prominent notices stating that You modified the concerned Mistral Model; and
41
+ Any terms and conditions You impose on any third-party recipients relating to Derivatives made by or for You shall neither limit such third-party recipients' use of the Mistral Model or any Derivatives made by or for Mistral AI in accordance with the Mistral AI Research License nor conflict with any of its terms and conditions.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  ## 3. Limitations
44
 
45
+ **3.1. Misrepresentation.** You must not misrepresent or imply, through any means, that the Derivatives made by or for You and/or any modified version of the Mistral Model You Distribute under your name and responsibility is an official product of Mistral AI or has been endorsed, approved or validated by Mistral AI, unless You are authorized by Us to do so in writing.
 
 
 
 
46
 
47
+ **3.2. Usage Limitation.** You shall only use the Mistral Models, Derivatives (whether or not created by Mistral AI) and Outputs for Research Purposes.
 
48
 
49
  ## 4. Intellectual Property
50
 
51
+ **4.1. Trademarks.** No trademark licenses are granted under this Agreement, and in connection with the Mistral Models, You may not use any name or mark owned by or associated with Mistral AI or any of its affiliates, except (i) as required for reasonable and customary use in describing and Distributing the Mistral Models and Derivatives made by or for Mistral AI and (ii) for attribution purposes as required by this Agreement.
 
 
 
 
 
52
 
53
+ **4.2. Outputs.** We claim no ownership rights in and to the Outputs. You are solely responsible for the Outputs You generate and their subsequent uses in accordance with this Agreement. Any Outputs shall be subject to the restrictions set out in Section 3 of this Agreement.
 
 
 
54
 
55
+ **4.3. Derivatives.** By entering into this Agreement, You accept that any Derivatives that You may create or that may be created for You shall be subject to the restrictions set out in Section 3 of this Agreement.
 
 
56
 
57
  ## 5. Liability
58
 
59
+ **5.1. Limitation of liability.** In no event, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall Mistral AI be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this Agreement or out of the use or inability to use the Mistral Models and Derivatives (including but not limited to damages for loss of data, loss of goodwill, loss of expected profit or savings, work stoppage, computer failure or malfunction, or any damage caused by malware or security breaches), even if Mistral AI has been advised of the possibility of such damages.
 
 
 
 
 
 
 
 
60
 
61
+ **5.2. Indemnification.** You agree to indemnify and hold harmless Mistral AI from and against any claims, damages, or losses arising out of or related to Your use or Distribution of the Mistral Models and Derivatives.
 
 
62
 
63
  ## 6. Warranty
64
 
65
+ **6.1. Disclaimer.** Unless required by applicable law or prior agreed to by Mistral AI in writing, Mistral AI provides the Mistral Models and Derivatives on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. Mistral AI does not represent nor warrant that the Mistral Models and Derivatives will be error-free, meet Your or any third party's requirements, be secure or will allow You or any third party to achieve any kind of result or generate any kind of content. You are solely responsible for determining the appropriateness of using or Distributing the Mistral Models and Derivatives and assume any risks associated with Your exercise of rights under this Agreement.
 
 
 
 
 
 
 
 
 
 
 
66
 
67
  ## 7. Termination
68
 
69
+ **7.1. Term.** This Agreement is effective as of the date of your acceptance of this Agreement or access to the concerned Mistral Models or Derivatives and will continue until terminated in accordance with the following terms.
70
+
71
+ **7.2. Termination.** Mistral AI may terminate this Agreement at any time if You are in breach of this Agreement. Upon termination of this Agreement, You must cease to use all Mistral Models and Derivatives and shall permanently delete any copy thereof. The following provisions, in their relevant parts, will survive any termination or expiration of this Agreement, each for the duration necessary to achieve its own intended purpose (e.g. the liability provision will survive until the end of the applicable limitation period):Sections 5 (Liability), 6(Warranty), 7 (Termination) and 8 (General Provisions).
72
+
73
+ **7.3. Litigation.** If You initiate any legal action or proceedings against Us or any other entity (including a cross-claim or counterclaim in a lawsuit), alleging that the Model or a Derivative, or any part thereof, infringe upon intellectual property or other rights owned or licensable by You, then any licenses granted to You under this Agreement will immediately terminate as of the date such legal action or claim is filed or initiated.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
  ## 8. General provisions
76
 
77
+ **8.1. Governing laws.** This Agreement will be governed by the laws of France, without regard to choice of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this Agreement.
 
 
 
78
 
79
+ **8.2. Competent jurisdiction.** The courts of Paris shall have exclusive jurisdiction of any dispute arising out of this Agreement.
 
80
 
81
+ **8.3. Severability.** If any provision of this Agreement is held to be invalid, illegal or unenforceable, the remaining provisions shall be unaffected thereby and remain valid as if such provision had not been set forth herein.
 
 
 
82
 
83
  ## 9. Definitions
84
 
85
+ "Agreement": means this Mistral AI Research License agreement governing the access, use, and Distribution of the Mistral Models, Derivatives and Outputs.
86
+
87
+ "Derivative": means any (i) modified version of the Mistral Model (including but not limited to any customized or fine-tuned version thereof), (ii) work based on the Mistral Model, or (iii) any other derivative work thereof.
88
+
89
+ "Distribution", "Distributing", "Distribute" or "Distributed": means supplying, providing or making available, by any means, a copy of the Mistral Models and/or the Derivatives as the case may be, subject to Section 3 of this Agreement.
90
+
91
+ "Mistral AI", "We" or "Us": means Mistral AI, a French société par actions simplifiée registered in the Paris commercial registry under the number 952 418 325, and having its registered seat at 15, rue des Halles, 75001 Paris.
92
+
93
+ "Mistral Model": means the foundational large language model(s), and its elements which include algorithms, software, instructed checkpoints, parameters, source code (inference code, evaluation code and, if applicable, fine-tuning code) and any other elements associated thereto made available by Mistral AI under this Agreement, including, if any, the technical documentation, manuals and instructions for the use and operation thereof.
94
+
95
+ "Research Purposes": means any use of a Mistral Model, Derivative, or Output that is solely for (a) personal, scientific or academic research, and (b) for non-profit and non-commercial purposes, and not directly or indirectly connected to any commercial activities or business operations. For illustration purposes, Research Purposes does not include (1) any usage of the Mistral Model, Derivative or Output by individuals or contractors employed in or engaged by companies in the context of (a) their daily tasks, or (b) any activity (including but not limited to any testing or proof-of-concept) that is intended to generate revenue, nor (2) any Distribution by a commercial entity of the Mistral Model, Derivative or Output whether in return for payment or free of charge, in any medium or form, including but not limited to through a hosted or managed service (e.g. SaaS, cloud instances, etc.), or behind a software layer.
96
+
97
+ "Outputs": means any content generated by the operation of the Mistral Models or the Derivatives from a prompt (i.e., text instructions) provided by users. For the avoidance of doubt, Outputs do not include any components of a Mistral Models, such as any fine-tuned versions of the Mistral Models, the weights, or parameters.
98
+
99
+ "You": means the individual or entity entering into this Agreement with Mistral AI.
100
+
101
+
102
+ *Mistral AI processes your personal data below to provide the model and enforce its license. If you are affiliated with a commercial entity, we may also send you communications about our models. For more information on your rights and data handling, please see our <a href="https://mistral.ai/terms/">privacy policy</a>.*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  extra_gated_fields:
104
  First Name: text
105
  Last Name: text
 
110
  I understand that if I am a commercial entity, I am not permitted to use or distribute the model internally or externally, or expose it in my own offerings without a commercial license: checkbox
111
  I understand that if I upload the model, or any derivative version, on any platform, I must include the Mistral Research License: checkbox
112
  I understand that for commercial use of the model, I can contact Mistral or use the Mistral AI API on la Plateforme or any of our cloud provider partners: checkbox
113
+ ? By clicking Submit below I accept the terms of the license and acknowledge that
114
+ the information I provide will be collected stored processed and shared in accordance
115
+ with the Mistral Privacy Policy
116
+ : checkbox
117
  geo: ip_location
118
  extra_gated_description: >-
119
+ Mistral AI processes your personal data below to provide the model and enforce its license. If you are affiliated with a commercial entity, we may also send you communications about our models. For more information on your rights and data handling, please see our <a href="https://mistral.ai/terms/">privacy policy</a>.
 
 
 
 
120
  extra_gated_button_content: Submit
121
+ library_name: vllm
 
 
122
  ---
123
 
124
  # Model Card for Pixtral-Large-Instruct-2411
125
 
126
  Pixtral-Large-Instruct-2411 is a 124B multimodal model built on top of Mistral Large 2, i.e., [Mistral-Large-Instruct-2407](https://huggingface.co/mistralai/Mistral-Large-Instruct-2407). Pixtral Large is the second model in our multimodal family and demonstrates frontier-level image understanding. Particularly, the model is able to understand documents, charts and natural images, while maintaining the leading text-only understanding of Mistral Large 2.
127
 
128
+ For more details about this model please refer to our release [blog post](https://mistral.ai/news/pixtral-large/) and [Pixtral 12B blog post](https://mistral.ai/news/pixtral-12b/).
 
 
 
 
 
 
129
 
130
  ## Key features
131
  - Frontier-class multimodal performance
132
+ - State-of-the-art on MathVista, DocVQA & VQAv2
133
  - Extends Mistral Large 2 without compromising text performance
134
  - 123B multimodal decoder, 1B parameter vision encoder
135
  - 128K context window: fits minimum of 30 high-resolution images
 
166
 
167
  | Model | MathVista (CoT) | MMMU (CoT) | ChartQA (CoT) | DocVQA (ANLS) | VQAv2 (VQA Match) | AI2D (BBox) | MM MT-Bench |
168
  |:----------------------------:|:---------------:|:----------:|:-------------:|:--------------:|:-----------------:|:-----------:|:-----------:|
169
+ | **Pixtral Large** | **<u>69.4</u>** | 64.0 | 88.1 | **<u>93.3</u>**| **<u>80.9</u>** | 93.8 | 7.4 |
170
  | Gemini-1.5 Pro (measured) | 67.8 | 66.3 | 83.8 | 92.3 | 70.6 | **<u>94.6</u>**| 6.8 |
171
+ | GPT-4o (measured) | 64.6 | **<u>68.6</u>**| 85.1 | 88.9 | 77.8 | 92.8 | **<u>7.7</u>**|
172
  | Claude-3.5 Sonnet (measured) | 67.1 | 68.4 | **<u>89.1</u>**| 88.6 | 69.5 | 76.9 | 7.3 |
 
 
 
 
 
173
 
174
  ## Usage
175
 
 
184
 
185
  **_Installation_**
186
 
187
+ Make sure you install `vLLM >= v0.6.4`:
188
 
189
  ```
190
  pip install --upgrade vllm
191
  ```
192
 
193
+ Also make sure you have `mistral_common >= 1.5.0` installed:
194
 
195
  ```
196
  pip install --upgrade mistral_common
197
  ```
198
 
199
+ You can also make use of a ready-to-go [docker image](https://github.com/vllm-project/vllm/blob/main/Dockerfile).
200
 
201
+ #### Text understanding example
202
+ ```py
203
+ from vllm import LLM
204
+ from vllm.sampling_params import SamplingParams
205
+ from huggingface_hub import hf_hub_download
206
+ from datetime import datetime, timedelta
207
 
208
+ model_name = "mistralai/Pixtral-Large-Instruct-2411"
 
209
 
210
+ def load_system_prompt(repo_id: str, filename: str) -> str:
211
+ file_path = hf_hub_download(repo_id=repo_id, filename=filename)
212
+ with open(file_path, 'r') as file:
213
+ system_prompt = file.read()
214
+ today = datetime.today().strftime('%Y-%m-%d')
215
+ yesterday = (datetime.today() - timedelta(days=1)).strftime('%Y-%m-%d')
216
+ model_name = repo_id.split("/")[-1]
217
+ return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
218
 
 
 
 
219
 
220
+ SYSTEM_PROMPT = load_system_prompt(model_name, "SYSTEM_PROMPT.txt")
221
+
222
+ user_prompt = "How many days ago was Mistral founded?"
223
+
224
+ messages = [
225
+ {
226
+ "role": "system",
227
+ "content": SYSTEM_PROMPT
228
+ },
229
+ {
230
+ "role": "user",
231
+ "content": user_prompt
232
+ },
233
+ ]
234
+
235
+ sampling_params = SamplingParams(max_tokens=128_000)
236
+
237
+ # note that running this model on GPU requires over 300 GB of GPU RAM
238
+ llm = LLM(model=model_name, tokenizer_mode="mistral", tensor_parallel_size=8, limit_mm_per_prompt={"image": 4}, max_model_len=32768)
239
+
240
+ outputs = llm.chat(messages, sampling_params=sampling_params)
241
+
242
+ print(outputs[0].outputs[0].text)
243
+ #Determining which country has the "best" food is subjective and depends on personal preferences. However, based on popular opinions and culinary reputation, I can provide a ranking.
244
+ #
245
+ #1. **Italy** (Light Brown) - Known for its pasta, pizza, and gelato.
246
+ # - Non-capital city on the map: Naples
247
+ #
248
+ #2. **France** (Dark Brown) - Renowned for its cuisine, including pastries, cheeses, and wines.
249
+ # - Non-capital city on the map: Bordeaux
250
+ #
251
+ #3. **Spain** (Yellow) - Famous for paella, tapas, and seafood.
252
+ # - Non-capital city on the map: Barcelona
253
+ #
254
+ #4. **Germany** (Orange) - Known for its sausages, pretzels, and beer.
255
+ # - Non-capital city on the map: Munich
256
+ #
257
+ #These rankings are based on general culinary fame and the visibility of non-capital cities on the provided map.
258
+ ```
259
 
260
+ #### Image understanding example
261
  ```py
262
+ from vllm import LLM
263
+ from vllm.sampling_params import SamplingParams
264
  from huggingface_hub import hf_hub_download
265
  from datetime import datetime, timedelta
266
 
267
+ model_name = "mistralai/Pixtral-Large-Instruct-2411"
 
 
 
 
268
 
269
  def load_system_prompt(repo_id: str, filename: str) -> str:
270
  file_path = hf_hub_download(repo_id=repo_id, filename=filename)
271
+ with open(file_path, 'r') as file:
272
  system_prompt = file.read()
273
+ today = datetime.today().strftime('%Y-%m-%d')
274
+ yesterday = (datetime.today() - timedelta(days=1)).strftime('%Y-%m-%d')
275
  model_name = repo_id.split("/")[-1]
276
  return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
277
 
278
+ SYSTEM_PROMPT = load_system_prompt(model_name, "SYSTEM_PROMPT.txt")
 
279
 
280
  image_url = "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/europe.png"
281
 
 
293
  },
294
  ]
295
 
296
+ sampling_params = SamplingParams(max_tokens=512)
297
 
298
+ # note that running this model on GPU requires over 300 GB of GPU RAM
299
+ llm = LLM(model=model_name, tokenizer_mode="mistral", tensor_parallel_size=8, limit_mm_per_prompt={"image": 4})
 
300
 
301
+ outputs = llm.chat(messages, sampling_params=sampling_params)
 
302
 
303
+ print(outputs[0].outputs[0].text)
304
+ ```
305
 
306
+ ### Server
307
+ We recommend to use Pixtral-Large-Instruct-2411 in a server/client setting.
308
 
309
+ 1. Spin up a server:
 
310
 
311
+ ```
312
+ vllm serve mistralai/Pixtral-Large-Instruct-2411 --tokenizer_mode mistral --limit_mm_per_prompt 'image=10' --tensor-parallel-size 8
313
  ```
314
 
315
+ 2. And ping the client:
 
 
 
 
316
 
317
  ```py
318
  import requests
 
320
  from huggingface_hub import hf_hub_download
321
  from datetime import datetime, timedelta
322
 
323
+ url = "http://slurm-h100-reserved-rno-202-041:8000/v1/chat/completions"
324
  headers = {"Content-Type": "application/json", "Authorization": "Bearer token"}
325
 
326
  model = "mistralai/Pixtral-Large-Instruct-2411"
 
340
 
341
  image_url = "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/europe.png"
342
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  messages = [
344
  {"role": "system", "content": SYSTEM_PROMPT},
345
  {
 
354
  },
355
  ]
356
 
357
+ data = {"model": model, "messages": messages}
358
 
359
+ response = requests.post(url, headers=headers, data=json.dumps(data))
360
+ print(response.json()["choices"][0]["message"]["content"])
361
+ # Determining which country has the "best" food can be subjective and depends on personal preferences. However, based on popular culinary reputations, here are some countries known for their cuisine:
362
 
363
+ #1. **Italy** (Brown) - Known for its pasta, pizza, and diverse regional dishes.
364
+ # - City: Milan
365
 
366
+ #2. **France** (Dark Brown) - Renowned for its fine dining, pastries, and wine.
367
+ # - City: Lyon
368
+
369
+ #3. **Spain** (Yellow) - Famous for tapas, paella, and a variety of seafood dishes.
370
+ # - City: Barcelona
371
+
372
+ #4. **Greece** (Yellow) - Known for its Mediterranean cuisine, including moussaka, souvlaki, and fresh seafood.
373
+ # - City: Thessaloniki
374
+
375
+ #These rankings are based on general culinary reputations and can vary widely depending on individual tastes.
376
  ```
377
+
378
 
379
  ## The Mistral AI Team
380
 
SYSTEM_PROMPT.txt CHANGED
@@ -16,4 +16,4 @@ You cannot perform any web search or access internet to open URLs, links etc. If
16
  # MULTI-MODAL INSTRUCTIONS
17
 
18
  You have the ability to read images, but you cannot generate images. You also cannot transcribe audio files or videos.
19
- You cannot read nor transcribe audio files or videos.
 
16
  # MULTI-MODAL INSTRUCTIONS
17
 
18
  You have the ability to read images, but you cannot generate images. You also cannot transcribe audio files or videos.
19
+ You cannot read nor transcribe audio files or videos and you cannot read images.
params.json CHANGED
@@ -8,7 +8,6 @@
8
  "rope_theta": 1000000000.0,
9
  "norm_eps": 1e-05,
10
  "vocab_size": 32768,
11
- "max_position_embeddings": 131072,
12
  "vision_encoder": {
13
  "hidden_size": 1408,
14
  "num_channels": 3,
@@ -18,9 +17,6 @@
18
  "intermediate_size": 6144,
19
  "num_hidden_layers": 40,
20
  "num_attention_heads": 16,
21
- "image_token_id": 10,
22
- "image_break_token_id": 14,
23
- "image_end_token_id": 15,
24
- "adapter_bias": false
25
  }
26
  }
 
8
  "rope_theta": 1000000000.0,
9
  "norm_eps": 1e-05,
10
  "vocab_size": 32768,
 
11
  "vision_encoder": {
12
  "hidden_size": 1408,
13
  "num_channels": 3,
 
17
  "intermediate_size": 6144,
18
  "num_hidden_layers": 40,
19
  "num_attention_heads": 16,
20
+ "image_token_id": 10
 
 
 
21
  }
22
  }