grimjim commited on
Commit
624e336
1 Parent(s): 102a69e

Removed consolidated safetensors

Browse files
.gitattributes CHANGED
@@ -7,6 +7,7 @@
7
  *.gz filter=lfs diff=lfs merge=lfs -text
8
  *.h5 filter=lfs diff=lfs merge=lfs -text
9
  *.joblib filter=lfs diff=lfs merge=lfs -text
 
10
  *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
  *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
  *.model filter=lfs diff=lfs merge=lfs -text
 
7
  *.gz filter=lfs diff=lfs merge=lfs -text
8
  *.h5 filter=lfs diff=lfs merge=lfs -text
9
  *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.json filter=lfs diff=lfs merge=lfs -text
11
  *.lfs.* filter=lfs diff=lfs merge=lfs -text
12
  *.mlmodel filter=lfs diff=lfs merge=lfs -text
13
  *.model filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ - fr
6
+ - de
7
+ - es
8
+ - it
9
+ - pt
10
+ - ru
11
+ - zh
12
+ - ja
13
+ ---
14
+
15
+ # Model Card for Mistral-Nemo-Instruct-2407
16
+
17
+ The Mistral-Nemo-Instruct-2407 Large Language Model (LLM) is an instruct fine-tuned version of the [Mistral-Nemo-Base-2407](https://huggingface.co/mistralai/Mistral-Nemo-Base-2407). Trained jointly by Mistral AI and NVIDIA, it significantly outperforms existing models smaller or similar in size.
18
+
19
+ For more details about this model please refer to our release [blog post](https://mistral.ai/news/mistral-nemo/).
20
+
21
+ ## Key features
22
+ - Released under the **Apache 2 License**
23
+ - Pre-trained and instructed versions
24
+ - Trained with a **128k context window**
25
+ - Trained on a large proportion of **multilingual and code data**
26
+ - Drop-in replacement of Mistral 7B
27
+
28
+ ## Model Architecture
29
+ Mistral Nemo is a transformer model, with the following architecture choices:
30
+ - **Layers:** 40
31
+ - **Dim:** 5,120
32
+ - **Head dim:** 128
33
+ - **Hidden dim:** 14,436
34
+ - **Activation Function:** SwiGLU
35
+ - **Number of heads:** 32
36
+ - **Number of kv-heads:** 8 (GQA)
37
+ - **Vocabulary size:** 2**17 ~= 128k
38
+ - **Rotary embeddings (theta = 1M)**
39
+
40
+ ## Metrics
41
+
42
+ ### Main Benchmarks
43
+
44
+ | Benchmark | Score |
45
+ | --- | --- |
46
+ | HellaSwag (0-shot) | 83.5% |
47
+ | Winogrande (0-shot) | 76.8% |
48
+ | OpenBookQA (0-shot) | 60.6% |
49
+ | CommonSenseQA (0-shot) | 70.4% |
50
+ | TruthfulQA (0-shot) | 50.3% |
51
+ | MMLU (5-shot) | 68.0% |
52
+ | TriviaQA (5-shot) | 73.8% |
53
+ | NaturalQuestions (5-shot) | 31.2% |
54
+
55
+ ### Multilingual Benchmarks (MMLU)
56
+
57
+ | Language | Score |
58
+ | --- | --- |
59
+ | French | 62.3% |
60
+ | German | 62.7% |
61
+ | Spanish | 64.6% |
62
+ | Italian | 61.3% |
63
+ | Portuguese | 63.3% |
64
+ | Russian | 59.2% |
65
+ | Chinese | 59.0% |
66
+ | Japanese | 59.0% |
67
+
68
+ ## Usage
69
+
70
+ The model can be used with three different frameworks
71
+
72
+ - [`mistral_inference`](https://github.com/mistralai/mistral-inference): See [here](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407#mistral-inference)
73
+ - [`transformers`](https://github.com/huggingface/transformers): See [here](#transformers)
74
+ - [`NeMo`](https://github.com/NVIDIA/NeMo): See [nvidia/Mistral-NeMo-12B-Instruct](https://huggingface.co/nvidia/Mistral-NeMo-12B-Instruct)
75
+
76
+ ### Mistral Inference
77
+
78
+ #### Install
79
+
80
+ It is recommended to use `mistralai/Mistral-Nemo-Instruct-2407` with [mistral-inference](https://github.com/mistralai/mistral-inference). For HF transformers code snippets, please keep scrolling.
81
+
82
+ ```
83
+ pip install mistral_inference
84
+ ```
85
+
86
+ #### Download
87
+
88
+ ```py
89
+ from huggingface_hub import snapshot_download
90
+ from pathlib import Path
91
+
92
+ mistral_models_path = Path.home().joinpath('mistral_models', 'Nemo-Instruct')
93
+ mistral_models_path.mkdir(parents=True, exist_ok=True)
94
+
95
+ snapshot_download(repo_id="mistralai/Mistral-Nemo-Instruct-2407", allow_patterns=["params.json", "consolidated.safetensors", "tekken.json"], local_dir=mistral_models_path)
96
+ ```
97
+
98
+ #### Chat
99
+
100
+ After installing `mistral_inference`, a `mistral-chat` CLI command should be available in your environment. You can chat with the model using
101
+
102
+ ```
103
+ mistral-chat $HOME/mistral_models/Nemo-Instruct --instruct --max_tokens 256 --temperature 0.35
104
+ ```
105
+
106
+ *E.g.* Try out something like:
107
+ ```
108
+ How expensive would it be to ask a window cleaner to clean all windows in Paris. Make a reasonable guess in US Dollar.
109
+ ```
110
+
111
+ #### Instruct following
112
+
113
+ ```py
114
+ from mistral_inference.transformer import Transformer
115
+ from mistral_inference.generate import generate
116
+
117
+ from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
118
+ from mistral_common.protocol.instruct.messages import UserMessage
119
+ from mistral_common.protocol.instruct.request import ChatCompletionRequest
120
+
121
+ tokenizer = MistralTokenizer.from_file(f"{mistral_models_path}/tekken.json")
122
+ model = Transformer.from_folder(mistral_models_path)
123
+
124
+ prompt = "How expensive would it be to ask a window cleaner to clean all windows in Paris. Make a reasonable guess in US Dollar."
125
+
126
+ completion_request = ChatCompletionRequest(messages=[UserMessage(content=prompt)])
127
+
128
+ tokens = tokenizer.encode_chat_completion(completion_request).tokens
129
+
130
+ out_tokens, _ = generate([tokens], model, max_tokens=64, temperature=0.35, eos_id=tokenizer.instruct_tokenizer.tokenizer.eos_id)
131
+ result = tokenizer.decode(out_tokens[0])
132
+
133
+ print(result)
134
+ ```
135
+
136
+ #### Function calling
137
+
138
+ ```py
139
+ from mistral_common.protocol.instruct.tool_calls import Function, Tool
140
+ from mistral_inference.transformer import Transformer
141
+ from mistral_inference.generate import generate
142
+
143
+ from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
144
+ from mistral_common.protocol.instruct.messages import UserMessage
145
+ from mistral_common.protocol.instruct.request import ChatCompletionRequest
146
+
147
+
148
+ tokenizer = MistralTokenizer.from_file(f"{mistral_models_path}/tekken.json")
149
+ model = Transformer.from_folder(mistral_models_path)
150
+
151
+ completion_request = ChatCompletionRequest(
152
+ tools=[
153
+ Tool(
154
+ function=Function(
155
+ name="get_current_weather",
156
+ description="Get the current weather",
157
+ parameters={
158
+ "type": "object",
159
+ "properties": {
160
+ "location": {
161
+ "type": "string",
162
+ "description": "The city and state, e.g. San Francisco, CA",
163
+ },
164
+ "format": {
165
+ "type": "string",
166
+ "enum": ["celsius", "fahrenheit"],
167
+ "description": "The temperature unit to use. Infer this from the users location.",
168
+ },
169
+ },
170
+ "required": ["location", "format"],
171
+ },
172
+ )
173
+ )
174
+ ],
175
+ messages=[
176
+ UserMessage(content="What's the weather like today in Paris?"),
177
+ ],
178
+ )
179
+
180
+ tokens = tokenizer.encode_chat_completion(completion_request).tokens
181
+
182
+ out_tokens, _ = generate([tokens], model, max_tokens=256, temperature=0.35, eos_id=tokenizer.instruct_tokenizer.tokenizer.eos_id)
183
+ result = tokenizer.decode(out_tokens[0])
184
+
185
+ print(result)
186
+ ```
187
+
188
+ ### Transformers
189
+
190
+ > [!IMPORTANT]
191
+ > NOTE: Until a new release has been made, you need to install transformers from source:
192
+ > ```sh
193
+ > pip install git+https://github.com/huggingface/transformers.git
194
+ > ```
195
+
196
+ If you want to use Hugging Face `transformers` to generate text, you can do something like this.
197
+
198
+ ```py
199
+ from transformers import pipeline
200
+
201
+ messages = [
202
+ {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
203
+ {"role": "user", "content": "Who are you?"},
204
+ ]
205
+ chatbot = pipeline("text-generation", model="mistralai/Mistral-Nemo-Instruct-2407")
206
+ chatbot(messages)
207
+ ```
208
+
209
+ > [!TIP]
210
+ > Unlike previous Mistral models, Mistral Nemo requires smaller temperatures. We recommend to use a temperature of 0.3.
211
+
212
+ ## Limitations
213
+
214
+ The Mistral Nemo Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
215
+ It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to
216
+ make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.
217
+
218
+ ## The Mistral AI Team
219
+
220
+ 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
config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11d36c89896b44021fe2d6654f9f877b94702561eb9d710471caa777fb5581ad
3
+ size 623
generation_config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c052c7f6082ca59fbee5478371f6dd18cbd9ec059b657f8081ff165deb9ea0fa
3
+ size 116
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model-00001-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37597b50c825674e56ff1b058f0d148b57dcbc1c39727b641a87ffbf247886ec
3
+ size 4865522496
model-00002-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cec7e36f1451270477569401d5c06af9df8f12da341ff446322796979a30d88b
3
+ size 4907529424
model-00003-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd68cdd7584ed9bdb5d891cd72fe05abbb50b6ad2860d147786d27a15f764aaa
3
+ size 4907529456
model-00004-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:02a05716064ca298c767b7accf9aed9153f9e090eff4605b871de005ce7ce3a9
3
+ size 4907529456
model-00005-of-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab7b1c33795a0a0997a6aa726f60da407e0aa61d62188c562ed2742cbeca87eb
3
+ size 4907496272
model.safetensors.index.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f14ac27ce39aa8652e83b8e3a9c59babba2831711e5b31512c1f96bfeeee09cf
3
+ size 29894
params.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9e1fe09246df854b90fda1bfc0064ad80cbd51b8301e08a08a7c63672ea744a
3
+ size 204
special_tokens_map.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6fa06efa2785e450051989a6f8fb4416b10149ded485ddd3f127a40734f5cfd0
3
+ size 414
tekken.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eccd1665d2e477697c33cb7f0daa6f6dfefc57a0a6bceb66d4be52952f827516
3
+ size 14801223
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e2bb147cebd31b68ba7b57052bc3c114c955052e9e941264478f498654c2445
3
+ size 9264745
tokenizer_config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:820ed7f6eb8ca1e7558708e5f427b455709eaef8efe2784bd3e2a32eb906368d
3
+ size 178120
vocab.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8572e8853a6b2f2d830de4afa15d43c49257d367abf3c5fd2f6f7687bcd8f63d
3
+ size 2472536