Views
No views yet
<s>[SYSTEM_PROMPT] <system prompt>[/SYSTEM_PROMPT][INST] <user message>[/INST] <assistant response></s>[INST] <user message>[/INST]| Model | MathVista (CoT) | MMMU (CoT) | ChartQA (CoT) | DocVQA (ANLS) | VQAv2 (VQA Match) | AI2D (BBox) | MM MT-Bench |
|---|---|---|---|---|---|---|---|
| Pixtral Large (124B) | 69.4 | 64.0 | 88.1 | 93.3 | 80.9 | 93.8 | 7.4 |
| Gemini-1.5 Pro (measured) | 67.8 | 66.3 | 83.8 | 92.3 | 70.6 | 94.6 | 6.8 |
| GPT-4o (measured) | 65.4 | 68.6 | 85.2 | 88.5 | 76.4 | 93.2 | 6.7 |
| Claude-3.5 Sonnet (measured) | 67.1 | 68.4 | 89.1 | 88.6 | 69.5 | 76.9 | 7.3 |
| Llama-3.2 90B (measured) | 49.1 | 53.7 | 70.8 | 85.7 | 67.0 | - | 5.5 |
vLLM >= v0.6.4.post1:pip install --upgrade vllmmistral_common >= 1.5.0 installed:pip install --upgrade mistral_commonvllm serve mistralai/Pixtral-Large-Instruct-2411 --config-format mistral --load-format mistral --tokenizer_mode mistral --limit_mm_per_prompt 'image=10' --tensor-parallel-size 81import requests
2import json
3from huggingface_hub import hf_hub_download
4from datetime import datetime, timedelta
5
6url = "http://<your-server-url>:8000/v1/chat/completions"
7headers = {"Content-Type": "application/json", "Authorization": "Bearer token"}
8
9model = "mistralai/Pixtral-Large-Instruct-2411"
10
11
12def load_system_prompt(repo_id: str, filename: str) -> str:
13 file_path = hf_hub_download(repo_id=repo_id, filename=filename)
14 with open(file_path, "r") as file:
15 system_prompt = file.read()
16 today = datetime.today().strftime("%Y-%m-%d")
17 yesterday = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
18 model_name = repo_id.split("/")[-1]
19 return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
20
21
22SYSTEM_PROMPT = load_system_prompt(model, "SYSTEM_PROMPT.txt")
23
24image_url = "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/europe.png"
25
26messages = [
27 {"role": "system", "content": SYSTEM_PROMPT},
28 {
29 "role": "user",
30 "content": [
31 {
32 "type": "text",
33 "text": "Which of the depicted countries has the best food? Which the second and third and fourth? Name the country, its color on the map and one its city that is visible on the map, but is not the capital. Make absolutely sure to only name a city that can be seen on the map.",
34 },
35 {"type": "image_url", "image_url": {"url": image_url}},
36 ],
37 },
38]
39
40data = {"model": model, "messages": messages}
41
42response = requests.post(url, headers=headers, data=json.dumps(data))
43print(response.json()["choices"][0]["message"]["content"])
44# 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:
45
46#1. **Italy** (Brown) - Known for its pasta, pizza, and diverse regional dishes.
47# - City: Milan
48
49#2. **France** (Dark Brown) - Renowned for its fine dining, pastries, and wine.
50# - City: Lyon
51
52#3. **Spain** (Yellow) - Famous for tapas, paella, and a variety of seafood dishes.
53# - City: Barcelona
54
55#4. **Greece** (Yellow) - Known for its Mediterranean cuisine, including moussaka, souvlaki, and fresh seafood.
56# - City: Thessaloniki
57
58#These rankings are based on general culinary reputations and can vary widely depending on individual tastes.1import requests
2import json
3from huggingface_hub import hf_hub_download
4from datetime import datetime, timedelta
5
6url = "http://<your-server-url>:8000/v1/chat/completions"
7headers = {"Content-Type": "application/json", "Authorization": "Bearer token"}
8
9model = "mistralai/Pixtral-Large-Instruct-2411"
10
11
12def load_system_prompt(repo_id: str, filename: str) -> str:
13 file_path = hf_hub_download(repo_id=repo_id, filename=filename)
14 with open(file_path, "r") as file:
15 system_prompt = file.read()
16 today = datetime.today().strftime("%Y-%m-%d")
17 yesterday = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
18 model_name = repo_id.split("/")[-1]
19 return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
20
21
22SYSTEM_PROMPT = load_system_prompt(model, "SYSTEM_PROMPT.txt")
23
24image_url = "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/europe.png"
25
26messages = [
27 {"role": "system", "content": SYSTEM_PROMPT},
28 {
29 "role": "user",
30 "content": "Without browsing the web, how many days ago was Mistral founded?"
31 },
32]
33
34data = {"model": model, "messages": messages}
35
36response = requests.post(url, headers=headers, data=json.dumps(data))
37print(response.json()["choices"][0]["message"]["content"])
38# 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.
39
40#First, calculate the days from April 2023 to the end of 2023:
41#- April: 27 days (30 - 3)
42#- May: 31 days
43#- June: 30 days
44#- July: 31 days
45#- August: 31 days
46#- September: 30 days
47#- October: 31 days
48#- November: 30 days
49#- December: 31 days
50
51#Total days from April 2023 to December 31, 2023: 27 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 = 272 days
52
53#Next, calculate the days from January 1, 2024, to November 18, 2024:
54#- January: 31 days
55#- February: 29 days (2024 is a leap year)
56#- March: 31 days
57#- April: 30 days
58#- May: 31 days
59#- June: 30 days
60#- July: 31 days
61#- August: 31 days
62#- September: 30 days
63#- October: 31 days
64#- November: 18 days
65
66#Total days from January 1, 2024, to November 18, 2024: 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 18 = 323 days
67
68#Adding the two periods together:
69#272 days (from April 2023 to December 2023) + 323 days (from January 2024 to November 18, 2024) = 595 days
70
71#Therefore, Mistral AI was founded 595 days ago from November 18, 2024.1from vllm import LLM
2from vllm.sampling_params import SamplingParams
3from huggingface_hub import hf_hub_download
4from datetime import datetime, timedelta
5
6model_name = "mistralai/Pixtral-Large-Instruct-2411"
7
8def load_system_prompt(repo_id: str, filename: str) -> str:
9 file_path = hf_hub_download(repo_id=repo_id, filename=filename)
10 with open(file_path, 'r') as file:
11 system_prompt = file.read()
12 today = datetime.today().strftime('%Y-%m-%d')
13 yesterday = (datetime.today() - timedelta(days=1)).strftime('%Y-%m-%d')
14 model_name = repo_id.split("/")[-1]
15 return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
16
17SYSTEM_PROMPT = load_system_prompt(model_name, "SYSTEM_PROMPT.txt")
18
19image_url = "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/europe.png"
20
21messages = [
22 {"role": "system", "content": SYSTEM_PROMPT},
23 {
24 "role": "user",
25 "content": [
26 {
27 "type": "text",
28 "text": "Which of the depicted countries has the best food? Which the second and third and fourth? Name the country, its color on the map and one its city that is visible on the map, but is not the capital. Make absolutely sure to only name a city that can be seen on the map.",
29 },
30 {"type": "image_url", "image_url": {"url": image_url}},
31 ],
32 },
33]
34
35sampling_params = SamplingParams(max_tokens=512)
36
37# note that running this model on GPU requires over 300 GB of GPU RAM
38llm = LLM(model=model_name, config_format="mistral", load_format="mistral", tokenizer_mode="mistral", tensor_parallel_size=8, limit_mm_per_prompt={"image": 4})
39
40outputs = llm.chat(messages, sampling_params=sampling_params)
41
42print(outputs[0].outputs[0].text)vllm serve neuralmagic/pixtral-12b-quantized.w8a8 --tensor_parallel_size 1 --max_model_len 25000 --trust_remote_code --max_num_seqs 8 --gpu_memory_utilization 0.9 --dtype float16 --limit_mm_per_prompt image=7
python -m eval.run eval_vllm \
--model_name neuralmagic/pixtral-12b-quantized.w8a8 \
--url http://0.0.0.0:8000 \
--output_dir ~/tmp \
--eval_name <vision_task_name>lm_eval \
--model vllm \
--model_args pretrained="<model_name>",dtype=auto,add_bos_token=True,max_model_len=4096,tensor_parallel_size=<n>,gpu_memory_utilization=0.8,enable_chunked_prefill=True,trust_remote_code=True \
--tasks mmlu \
--num_fewshot 5 \
--batch_size auto \
--output_path output_dir
lm_eval \
--model vllm \
--model_args pretrained="<model_name>",dtype=auto,max_model_len=4096,max_gen_toks=2048,max_num_seqs=128,tensor_parallel_size=<n>,gpu_memory_utilization=0.9 \
--tasks mgsm_cot_native \
--apply_chat_template \
--num_fewshot 0 \
--batch_size auto \
--output_path output_dir
| Category | Metric | neuralmagic/Pixtral-Large-Instruct-2411-hf | neuralmagic/Pixtral-Large-Instruct-2411-hf-FP8-dynamic | Recovery (%) |
|---|---|---|---|---|
| Vision | MMMU (val, CoT) explicit_prompt_relaxed_correctness | 63.56 | 63.44 | 99.81% |
| VQAv2 (val) vqa_match | 79.03 | 79.06 | 100.04% | |
| DocVQA (val) anls | 89.55 | 89.63 | 100.09% | |
| ChartQA (test, CoT) anywhere_in_answer_relaxed_correctness | 82.24 | 82.80 | 100.68% | |
| Mathvista (testmini, CoT) explicit_prompt_relaxed_correctness | 67.3 | 66.50 | 98.81% | |
| Average Score | 76.34 | 76.29 | 99.93% | |
| Text | MGSM (CoT) | 76.05 | 75.58 | 99.38% |
| MMLU (5-shot) | 82.8 | 82.74 | 99.93% |
| Document Visual Question Answering 1680W x 2240H 64/128 | Visual Reasoning 640W x 480H 128/128 | Image Captioning 480W x 360H 0/128 | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Hardware | Number of GPUs | Model | Average Cost Reduction | Latency (s) | Queries Per Dollar | Latency (s) | Queries Per Dollar | Latency (s) | Queries Per Dollar |
| A100 | 4 | neuralmagic/Pixtral-Large-Instruct-2411-hf | 7.5 | 67 | 6.5 | 77 | 6.4 | 79 | |
| 2 | neuralmagic/Pixtral-Large-Instruct-2411-hf-quantized.w8a8 | 1.86 | 8.1 | 124 | 7.1 | 142 | 6.8 | 148 | |
| 2 | neuralmagic/Pixtral-Large-Instruct-2411-hf-quantized.w4a16 | 2.52 | 6.9 | 147 | 5.1 | 199 | 4.5 | 221 | |
| H100 | 4 | neuralmagic/Pixtral-Large-Instruct-2411-hf | 4.4 | 67 | 3.9 | 74 | 3.7 | 79 | |
| 2 | neuralmagic/Pixtral-Large-Instruct-2411-hf-FP8-Dynamic | 1.82 | 4.7 | 120 | 4.1 | 137 | 3.9 | 145 | |
| 2 | neuralmagic/Pixtral-Large-Instruct-2411-hf-quantized.w4a16 | 1.87 | 4.7 | 120 | 3.9 | 144 | 3.8 | 149 |
| Document Visual Question Answering 1680W x 2240H 64/128 | Visual Reasoning 640W x 480H 128/128 | Image Captioning 480W x 360H 0/128 | ||||||
|---|---|---|---|---|---|---|---|---|
| Hardware | Model | Average Cost Reduction | Maximum throughput (QPS) | Queries Per Dollar | Maximum throughput (QPS) | Queries Per Dollar | Maximum throughput (QPS) | Queries Per Dollar |
| A100x4 | neuralmagic/Pixtral-Large-Instruct-2411-hf | 0.4 | 222 | 0.7 | 341 | 0.8 | 399 | |
| neuralmagic/Pixtral-Large-Instruct-2411-hf-quantized.w8a8 | 1.70 | 0.8 | 383 | 1.1 | 571 | 1.3 | 674 | |
| neuralmagic/Pixtral-Large-Instruct-2411-hf-quantized.w4a16 | 1.48 | 0.5 | 276 | 1.0 | 505 | 1.4 | 680 | |
| H100x4 | neuralmagic/Pixtral-Large-Instruct-2411-hf | 1.0 | 284 | 1.6 | 465 | 1.8 | 511 | |
| neuralmagic/Pixtral-Large-Instruct-2411-hf-FP8-Dynamic | 1.61 | 1.7 | 467 | 2.6 | 726 | 3.2 | 908 | |
| neuralmagic/Pixtral-Large-Instruct-2411-hf-quantized.w4a16 | 1.33 | 1.4 | 393 | 2.2 | 726 | 2.7 | 764 |
| Document Visual Question Answering 1680W x 2240H 64/128 | Visual Reasoning 640W x 480H 128/128 | Image Captioning 480W x 360H 0/128 | ||||||
|---|---|---|---|---|---|---|---|---|
| Hardware | Model | Average Cost Reduction | Maximum throughput (QPS) | Queries Per Dollar | Maximum throughput (QPS) | Queries Per Dollar | Maximum throughput (QPS) | Queries Per Dollar |
| A100x4 | neuralmagic/Pixtral-Large-Instruct-2411-hf | 0.4 | 222 | 0.7 | 341 | 0.8 | 399 | |
| neuralmagic/Pixtral-Large-Instruct-2411-hf-quantized.w8a8 | 1.70 | 0.8 | 766 | 1.1 | 1142 | 1.3 | 1348 | |
| neuralmagic/Pixtral-Large-Instruct-2411-hf-quantized.w4a16 | 1.48 | 0.5 | 552 | 1.0 | 1010 | 1.4 | 1360 | |
| H100x4 | neuralmagic/Pixtral-Large-Instruct-2411-hf | 1.0 | 284 | 1.6 | 465 | 1.8 | 511 | |
| neuralmagic/Pixtral-Large-Instruct-2411-hf-FP8-Dynamic | 1.61 | 1.7 | 905 | 2.6 | 1406 | 3.2 | 1759 | |
| neuralmagic/Pixtral-Large-Instruct-2411-hf-quantized.w4a16 | 1.33 | 1.4 | 761 | 2.2 | 1228 | 2.7 | 1480 |