Prince-1 commited on
Commit
8f22a29
·
verified ·
1 Parent(s): 9a40c6e

Build the onnx format of model Mistral-Nemo-Base-2407

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ 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
 
 
 
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
+ model.onnx.data filter=lfs diff=lfs merge=lfs -text
37
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ base_model:
14
+ - mistralai/Mistral-Nemo-Base-2407
15
+ library_name: onnxruntime_genai
16
+ tags:
17
+ - mistral3
18
+ - onnx
19
+ - onnxruntime-genai
20
+ - text-generation-inference
21
+ base_model_relation: quantized
22
+ ---
23
+
24
+ # Model Card for Mistral-Nemo-Base-2407
25
+
26
+ The Mistral-Nemo-Base-2407 Large Language Model (LLM) is a pretrained generative text model of 12B parameters trained jointly by Mistral AI and NVIDIA, it significantly outperforms existing models smaller or similar in size.
27
+
28
+ For more details about this model please refer to our release [blog post](https://mistral.ai/news/mistral-nemo/).
29
+
30
+ ## Key features
31
+ - Released under the **Apache 2 License**
32
+ - Pre-trained and instructed versions
33
+ - Trained with a **128k context window**
34
+ - Trained on a large proportion of **multilingual and code data**
35
+ - Drop-in replacement of Mistral 7B
36
+
37
+ ## Model Architecture
38
+ Mistral Nemo is a transformer model, with the following architecture choices:
39
+ - **Layers:** 40
40
+ - **Dim:** 5,120
41
+ - **Head dim:** 128
42
+ - **Hidden dim:** 14,436
43
+ - **Activation Function:** SwiGLU
44
+ - **Number of heads:** 32
45
+ - **Number of kv-heads:** 8 (GQA)
46
+ - **Vocabulary size:** 2**17 ~= 128k
47
+ - **Rotary embeddings (theta = 1M)**
48
+
49
+ ## Metrics
50
+
51
+ ### Main Benchmarks
52
+
53
+ | Benchmark | Score |
54
+ | --- | --- |
55
+ | HellaSwag (0-shot) | 83.5% |
56
+ | Winogrande (0-shot) | 76.8% |
57
+ | OpenBookQA (0-shot) | 60.6% |
58
+ | CommonSenseQA (0-shot) | 70.4% |
59
+ | TruthfulQA (0-shot) | 50.3% |
60
+ | MMLU (5-shot) | 68.0% |
61
+ | TriviaQA (5-shot) | 73.8% |
62
+ | NaturalQuestions (5-shot) | 31.2% |
63
+
64
+ ### Multilingual Benchmarks (MMLU)
65
+
66
+ | Language | Score |
67
+ | --- | --- |
68
+ | French | 62.3% |
69
+ | German | 62.7% |
70
+ | Spanish | 64.6% |
71
+ | Italian | 61.3% |
72
+ | Portuguese | 63.3% |
73
+ | Russian | 59.2% |
74
+ | Chinese | 59.0% |
75
+ | Japanese | 59.0% |
76
+
77
+
78
+ ## Usage
79
+
80
+ The model can be used with three different frameworks
81
+
82
+ - [`mistral_inference`](https://github.com/mistralai/mistral-inference): See [here](#mistral-inference)
83
+ - [`transformers`](https://github.com/huggingface/transformers): See [here](#transformers)
84
+ - [`NeMo`](https://github.com/NVIDIA/NeMo): See [nvidia/Mistral-NeMo-12B-Base](https://huggingface.co/nvidia/Mistral-NeMo-12B-Base)
85
+
86
+
87
+ ### Mistral Inference
88
+
89
+
90
+ #### Install
91
+
92
+ It is recommended to use `mistralai/Mistral-Nemo-Base-2407` with [mistral-inference](https://github.com/mistralai/mistral-inference).
93
+ For HF transformers code snippets, please keep scrolling.
94
+
95
+ ```
96
+ pip install mistral_inference
97
+ ```
98
+
99
+ #### Download
100
+
101
+ ```py
102
+ from huggingface_hub import snapshot_download
103
+ from pathlib import Path
104
+
105
+ mistral_models_path = Path.home().joinpath('mistral_models', 'Nemo-v0.1')
106
+ mistral_models_path.mkdir(parents=True, exist_ok=True)
107
+
108
+ snapshot_download(repo_id="mistralai/Mistral-Nemo-Base-2407", allow_patterns=["params.json", "consolidated.safetensors", "tekken.json"], local_dir=mistral_models_path)
109
+ ```
110
+
111
+ #### Demo
112
+
113
+ After installing `mistral_inference`, a `mistral-demo` CLI command should be available in your environment.
114
+
115
+ ```
116
+ mistral-demo $HOME/mistral_models/Nemo-v0.1
117
+ ```
118
+
119
+ ### Transformers
120
+
121
+ > [!IMPORTANT]
122
+ > NOTE: Until a new release has been made, you need to install transformers from source:
123
+ > ```sh
124
+ > pip install git+https://github.com/huggingface/transformers.git
125
+ > ```
126
+
127
+ If you want to use Hugging Face `transformers` to generate text, you can do something like this.
128
+
129
+ ```py
130
+ from transformers import AutoModelForCausalLM, AutoTokenizer
131
+
132
+ model_id = "mistralai/Mistral-Nemo-Base-2407"
133
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
134
+
135
+ model = AutoModelForCausalLM.from_pretrained(model_id)
136
+ inputs = tokenizer("Hello my name is", return_tensors="pt")
137
+
138
+ outputs = model.generate(**inputs, max_new_tokens=20)
139
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
140
+ ```
141
+
142
+ > [!TIP]
143
+ > Unlike previous Mistral models, Mistral Nemo requires smaller temperatures. We recommend to use a temperature of 0.3.
144
+
145
+ ## Note
146
+
147
+ `Mistral-Nemo-Base-2407` is a pretrained base model and therefore does not have any moderation mechanisms.
148
+
149
+ ## The Mistral AI Team
150
+
151
+ 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
genai_config.json ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": {
3
+ "bos_token_id": 1,
4
+ "context_length": 131072,
5
+ "decoder": {
6
+ "session_options": {
7
+ "log_id": "onnxruntime-genai",
8
+ "provider_options": []
9
+ },
10
+ "filename": "model.onnx",
11
+ "head_size": 128,
12
+ "hidden_size": 5120,
13
+ "inputs": {
14
+ "input_ids": "input_ids",
15
+ "attention_mask": "attention_mask",
16
+ "position_ids": "position_ids",
17
+ "past_key_names": "past_key_values.%d.key",
18
+ "past_value_names": "past_key_values.%d.value"
19
+ },
20
+ "outputs": {
21
+ "logits": "logits",
22
+ "present_key_names": "present.%d.key",
23
+ "present_value_names": "present.%d.value"
24
+ },
25
+ "num_attention_heads": 32,
26
+ "num_hidden_layers": 40,
27
+ "num_key_value_heads": 8
28
+ },
29
+ "eos_token_id": 2,
30
+ "pad_token_id": 2,
31
+ "type": "mistral",
32
+ "vocab_size": 131072
33
+ },
34
+ "search": {
35
+ "diversity_penalty": 0.0,
36
+ "do_sample": false,
37
+ "early_stopping": true,
38
+ "length_penalty": 1.0,
39
+ "max_length": 131072,
40
+ "min_length": 0,
41
+ "no_repeat_ngram_size": 0,
42
+ "num_beams": 1,
43
+ "num_return_sequences": 1,
44
+ "past_present_share_buffer": false,
45
+ "repetition_penalty": 1.0,
46
+ "temperature": 1.0,
47
+ "top_k": 1,
48
+ "top_p": 1.0
49
+ }
50
+ }
model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df6b85a64d1850b9f268416afd11cd056fc4e98abacdfa4ab2a81978ba80947f
3
+ size 929178
model.onnx.data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:de97267148e4c181defff437585d55e8aad84ccbb5393d111a3a363bad7548b1
3
+ size 24529119232
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "unk_token": {
17
+ "content": "<unk>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0240ce510f08e6c2041724e9043e33be9d251d1e4a4d94eb68cd47b954b61d2
3
+ size 17078292
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff