TechxGenus commited on
Commit
cc5b7e0
1 Parent(s): 822c79a

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +236 -0
README.md ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: mrl
4
+ license_link: https://mistral.ai/licenses/MRL-0.1.md
5
+ language:
6
+ - en
7
+ - fr
8
+ - de
9
+ - es
10
+ - it
11
+ - pt
12
+ - zh
13
+ - ja
14
+ - ru
15
+ - ko
16
+
17
+ extra_gated_description: If you want to learn more about how we process your personal data, please read our <a href="https://mistral.ai/terms/">Privacy Policy</a>.
18
+ ---
19
+
20
+ AWQ quantized version of Mistral-Large-Instruct-2407 model.
21
+
22
+ ---
23
+
24
+ # Model Card for Mistral-Large-Instruct-2407
25
+
26
+ Mistral-Large-Instruct-2407 is an advanced dense Large Language Model (LLM) of 123B parameters with state-of-the-art reasoning, knowledge and coding capabilities.
27
+
28
+ For more details about this model please refer to our release [blog post](https://mistral.ai/news/mistral-large-2407/).
29
+
30
+ ## Key features
31
+ - **Multi-lingual by design:** Dozens of languages supported, including English, French, German, Spanish, Italian, Chinese, Japanese, Korean, Portuguese, Dutch and Polish.
32
+ - **Proficient in coding:** Trained on 80+ coding languages such as Python, Java, C, C++, Javacsript, and Bash. Also trained on more specific languages such as Swift and Fortran.
33
+ - **Agentic-centric:** Best-in-class agentic capabilities with native function calling and JSON outputting.
34
+ - **Advanced Reasoning:** State-of-the-art mathematical and reasoning capabilities.
35
+ - **Mistral Research License:** Allows usage and modification for research and non-commercial usages.
36
+ - **Large Context:** A large 128k context window.
37
+
38
+ ## Metrics
39
+
40
+ ### Base Pretrained Benchmarks
41
+
42
+ | Benchmark | Score |
43
+ | --- | --- |
44
+ | MMLU | 84.0% |
45
+
46
+
47
+ ### Base Pretrained Multilingual Benchmarks (MMLU)
48
+ | Benchmark | Score |
49
+ | --- | --- |
50
+ | French | 82.8% |
51
+ | German | 81.6% |
52
+ | Spanish | 82.7% |
53
+ | Italian | 82.7% |
54
+ | Dutch | 80.7% |
55
+ | Portuguese | 81.6% |
56
+ | Russian | 79.0% |
57
+ | Korean | 60.1% |
58
+ | Japanese | 78.8% |
59
+ | Chinese | 74.8% |
60
+
61
+
62
+ ### Instruction Benchmarks
63
+
64
+ | Benchmark | Score |
65
+ | --- | --- |
66
+ | MT Bench | 8.63 |
67
+ | Wild Bench | 56.3 |
68
+ | Arena Hard| 73.2 |
69
+
70
+ ### Code & Reasoning Benchmarks
71
+ | Benchmark | Score |
72
+ | --- | --- |
73
+ | Human Eval | 92% |
74
+ | Human Eval Plus| 87% |
75
+ | MBPP Base| 80% |
76
+ | MBPP Plus| 69% |
77
+
78
+ ### Math Benchmarks
79
+
80
+ | Benchmark | Score |
81
+ | --- | --- |
82
+ | GSM8K | 93% |
83
+ | Math Instruct (0-shot, no CoT) | 70% |
84
+ | Math Instruct (0-shot, CoT)| 71.5% |
85
+
86
+ ## Usage
87
+
88
+ The model can be used with two different frameworks
89
+
90
+ - [`mistral_inference`](https://github.com/mistralai/mistral-inference): See [here](https://huggingface.co/mistralai/Mistral-Large-2407#mistral-inference)
91
+ - [`transformers`](https://github.com/huggingface/transformers): See [here](#transformers)
92
+
93
+ ### Mistral Inference
94
+
95
+ #### Install
96
+
97
+ It is recommended to use `mistralai/Mistral-Large-2407` with [mistral-inference](https://github.com/mistralai/mistral-inference). For HF transformers code snippets, please keep scrolling.
98
+
99
+ ```
100
+ pip install mistral_inference
101
+ ```
102
+
103
+ #### Download
104
+
105
+ ```py
106
+ from huggingface_hub import snapshot_download
107
+ from pathlib import Path
108
+
109
+ mistral_models_path = Path.home().joinpath('mistral_models', 'Large')
110
+ mistral_models_path.mkdir(parents=True, exist_ok=True)
111
+
112
+ snapshot_download(repo_id="mistralai/Mistral-Large-2407", allow_patterns=["params.json", "consolidated-*.safetensors", "tokenizer.model.v3"], local_dir=mistral_models_path)
113
+ ```
114
+
115
+ #### Chat
116
+
117
+ After installing `mistral_inference`, a `mistral-chat` CLI command should be available in your environment.
118
+ Given the size of this model, you will need a node with several GPUs (more than 300GB cumulated vRAM).
119
+ If you have 8 GPUs on your machine, you can chat with the model using
120
+
121
+ ```
122
+ torchrun --nproc-per-node 8 --no-python mistral-chat $HOME/mistral_models/Large --instruct --max_tokens 256 --temperature 0.7
123
+ ```
124
+
125
+ *E.g.* Try out something like:
126
+ ```
127
+ How expensive would it be to ask a window cleaner to clean all windows in Paris. Make a reasonable guess in US Dollar.
128
+ ```
129
+
130
+ #### Instruct following
131
+
132
+ ```py
133
+ from mistral_inference.transformer import Transformer
134
+ from mistral_inference.generate import generate
135
+
136
+ from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
137
+ from mistral_common.protocol.instruct.messages import UserMessage
138
+ from mistral_common.protocol.instruct.request import ChatCompletionRequest
139
+
140
+ tokenizer = MistralTokenizer.from_file(f"{mistral_models_path}/tokenizer.model.v3")
141
+ model = Transformer.from_folder(mistral_models_path)
142
+
143
+ prompt = "How expensive would it be to ask a window cleaner to clean all windows in Paris. Make a reasonable guess in US Dollar."
144
+
145
+ completion_request = ChatCompletionRequest(messages=[UserMessage(content=prompt)])
146
+
147
+ tokens = tokenizer.encode_chat_completion(completion_request).tokens
148
+
149
+ out_tokens, _ = generate([tokens], model, max_tokens=64, temperature=0.7, eos_id=tokenizer.instruct_tokenizer.tokenizer.eos_id)
150
+ result = tokenizer.decode(out_tokens[0])
151
+
152
+ print(result)
153
+ ```
154
+
155
+ #### Function calling
156
+
157
+ ```py
158
+ from mistral_common.protocol.instruct.tool_calls import Function, Tool
159
+ from mistral_inference.transformer import Transformer
160
+ from mistral_inference.generate import generate
161
+
162
+ from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
163
+ from mistral_common.protocol.instruct.messages import UserMessage
164
+ from mistral_common.protocol.instruct.request import ChatCompletionRequest
165
+
166
+
167
+ tokenizer = MistralTokenizer.from_file(f"{mistral_models_path}/tokenizer.model.v3")
168
+ model = Transformer.from_folder(mistral_models_path)
169
+
170
+ completion_request = ChatCompletionRequest(
171
+ tools=[
172
+ Tool(
173
+ function=Function(
174
+ name="get_current_weather",
175
+ description="Get the current weather",
176
+ parameters={
177
+ "type": "object",
178
+ "properties": {
179
+ "location": {
180
+ "type": "string",
181
+ "description": "The city and state, e.g. San Francisco, CA",
182
+ },
183
+ "format": {
184
+ "type": "string",
185
+ "enum": ["celsius", "fahrenheit"],
186
+ "description": "The temperature unit to use. Infer this from the users location.",
187
+ },
188
+ },
189
+ "required": ["location", "format"],
190
+ },
191
+ )
192
+ )
193
+ ],
194
+ messages=[
195
+ UserMessage(content="What's the weather like today in Paris?"),
196
+ ],
197
+ )
198
+
199
+ tokens = tokenizer.encode_chat_completion(completion_request).tokens
200
+
201
+ out_tokens, _ = generate([tokens], model, max_tokens=256, temperature=0.7, eos_id=tokenizer.instruct_tokenizer.tokenizer.eos_id)
202
+ result = tokenizer.decode(out_tokens[0])
203
+
204
+ print(result)
205
+ ```
206
+
207
+ ### Transformers
208
+
209
+ > [!IMPORTANT]
210
+ > NOTE: Until a new release has been made, you need to install transformers from source:
211
+ > ```sh
212
+ > pip install git+https://github.com/huggingface/transformers.git
213
+ > ```
214
+
215
+ If you want to use Hugging Face `transformers` to generate text, you can do something like this.
216
+
217
+ ```py
218
+ from transformers import pipeline
219
+
220
+ messages = [
221
+ {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
222
+ {"role": "user", "content": "Who are you?"},
223
+ ]
224
+ chatbot = pipeline("text-generation", model="mistralai/Mistral-Large-2407")
225
+ chatbot(messages)
226
+ ```
227
+
228
+ ## Limitations
229
+
230
+ The Mistral Large model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
231
+ It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to
232
+ make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.
233
+
234
+ ## The Mistral AI Team
235
+
236
+ 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, Diogo Costa, 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