avemio-digital commited on
Commit
4a1e72f
verified
1 Parent(s): 541243c

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +144 -0
README.md ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ 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>.
15
+ ---
16
+
17
+ # Model Card for Mistral-Nemo-Base-2407
18
+
19
+ 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.
20
+
21
+ For more details about this model please refer to our release [blog post](https://mistral.ai/news/mistral-nemo/).
22
+
23
+ ## Key features
24
+ - Released under the **Apache 2 License**
25
+ - Pre-trained and instructed versions
26
+ - Trained with a **128k context window**
27
+ - Trained on a large proportion of **multilingual and code data**
28
+ - Drop-in replacement of Mistral 7B
29
+
30
+ ## Model Architecture
31
+ Mistral Nemo is a transformer model, with the following architecture choices:
32
+ - **Layers:** 40
33
+ - **Dim:** 5,120
34
+ - **Head dim:** 128
35
+ - **Hidden dim:** 14,436
36
+ - **Activation Function:** SwiGLU
37
+ - **Number of heads:** 32
38
+ - **Number of kv-heads:** 8 (GQA)
39
+ - **Vocabulary size:** 2**17 ~= 128k
40
+ - **Rotary embeddings (theta = 1M)**
41
+
42
+ ## Metrics
43
+
44
+ ### Main Benchmarks
45
+
46
+ | Benchmark | Score |
47
+ | --- | --- |
48
+ | HellaSwag (0-shot) | 83.5% |
49
+ | Winogrande (0-shot) | 76.8% |
50
+ | OpenBookQA (0-shot) | 60.6% |
51
+ | CommonSenseQA (0-shot) | 70.4% |
52
+ | TruthfulQA (0-shot) | 50.3% |
53
+ | MMLU (5-shot) | 68.0% |
54
+ | TriviaQA (5-shot) | 73.8% |
55
+ | NaturalQuestions (5-shot) | 31.2% |
56
+
57
+ ### Multilingual Benchmarks (MMLU)
58
+
59
+ | Language | Score |
60
+ | --- | --- |
61
+ | French | 62.3% |
62
+ | German | 62.7% |
63
+ | Spanish | 64.6% |
64
+ | Italian | 61.3% |
65
+ | Portuguese | 63.3% |
66
+ | Russian | 59.2% |
67
+ | Chinese | 59.0% |
68
+ | Japanese | 59.0% |
69
+
70
+
71
+ ## Usage
72
+
73
+ The model can be used with three different frameworks
74
+
75
+ - [`mistral_inference`](https://github.com/mistralai/mistral-inference): See [here](#mistral-inference)
76
+ - [`transformers`](https://github.com/huggingface/transformers): See [here](#transformers)
77
+ - [`NeMo`](https://github.com/NVIDIA/NeMo): See [nvidia/Mistral-NeMo-12B-Base](https://huggingface.co/nvidia/Mistral-NeMo-12B-Base)
78
+
79
+
80
+ ### Mistral Inference
81
+
82
+
83
+ #### Install
84
+
85
+ It is recommended to use `mistralai/Mistral-Nemo-Base-2407` with [mistral-inference](https://github.com/mistralai/mistral-inference).
86
+ For HF transformers code snippets, please keep scrolling.
87
+
88
+ ```
89
+ pip install mistral_inference
90
+ ```
91
+
92
+ #### Download
93
+
94
+ ```py
95
+ from huggingface_hub import snapshot_download
96
+ from pathlib import Path
97
+
98
+ mistral_models_path = Path.home().joinpath('mistral_models', 'Nemo-v0.1')
99
+ mistral_models_path.mkdir(parents=True, exist_ok=True)
100
+
101
+ snapshot_download(repo_id="mistralai/Mistral-Nemo-Base-2407", allow_patterns=["params.json", "consolidated.safetensors", "tekken.json"], local_dir=mistral_models_path)
102
+ ```
103
+
104
+ #### Demo
105
+
106
+ After installing `mistral_inference`, a `mistral-demo` CLI command should be available in your environment.
107
+
108
+ ```
109
+ mistral-demo $HOME/mistral_models/Nemo-v0.1
110
+ ```
111
+
112
+ ### Transformers
113
+
114
+ > [!IMPORTANT]
115
+ > NOTE: Until a new release has been made, you need to install transformers from source:
116
+ > ```sh
117
+ > pip install git+https://github.com/huggingface/transformers.git
118
+ > ```
119
+
120
+ If you want to use Hugging Face `transformers` to generate text, you can do something like this.
121
+
122
+ ```py
123
+ from transformers import AutoModelForCausalLM, AutoTokenizer
124
+
125
+ model_id = "mistralai/Mistral-Nemo-Base-2407"
126
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
127
+
128
+ model = AutoModelForCausalLM.from_pretrained(model_id)
129
+ inputs = tokenizer("Hello my name is", return_tensors="pt")
130
+
131
+ outputs = model.generate(**inputs, max_new_tokens=20)
132
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
133
+ ```
134
+
135
+ > [!TIP]
136
+ > Unlike previous Mistral models, Mistral Nemo requires smaller temperatures. We recommend to use a temperature of 0.3.
137
+
138
+ ## Note
139
+
140
+ `Mistral-Nemo-Base-2407` is a pretrained base model and therefore does not have any moderation mechanisms.
141
+
142
+ ## The Mistral AI Team
143
+
144
+ 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