andrijdavid commited on
Commit
f3a2cda
1 Parent(s): ac98fed

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,20 @@ 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
+ Q2_K/Q2_K-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
37
+ Q3_K/Q3_K-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
38
+ Q3_K_L/Q3_K_L-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
39
+ Q3_K_M/Q3_K_M-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
40
+ Q3_K_S/Q3_K_S-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
41
+ Q4_0/Q4_0-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
42
+ Q4_1/Q4_1-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
43
+ Q4_K/Q4_K-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
44
+ Q4_K_M/Q4_K_M-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
45
+ Q4_K_S/Q4_K_S-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
46
+ Q5_0/Q5_0-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
47
+ Q5_1/Q5_1-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
48
+ Q5_K/Q5_K-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
49
+ Q5_K_M/Q5_K_M-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
50
+ Q5_K_S/Q5_K_S-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
51
+ Q6_K/Q6_K-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
52
+ Q8_0/Q8_0-00001-of-00001.gguf filter=lfs diff=lfs merge=lfs -text
Q2_K/Q2_K-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b75a2710cf2bcbd12724f7afaf4b92e985b299e7d10c0249eb0edda54778dac
3
+ size 4791047872
Q3_K/Q3_K-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eefd4a762b6a08410158ddd191207c6567f0d8c0c75f81b44c75046c4086cbae
3
+ size 6083090112
Q3_K_L/Q3_K_L-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f59bfe840deafec5b96014a5a2125aa27d28278551c2a30b1bd5cc0c9c5a282
3
+ size 6561502912
Q3_K_M/Q3_K_M-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eefd4a762b6a08410158ddd191207c6567f0d8c0c75f81b44c75046c4086cbae
3
+ size 6083090112
Q3_K_S/Q3_K_S-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3842eb732ce303a2ad5989c897825d9c2b0df50bbda29a80b4412043c76663b
3
+ size 5534226112
Q4_0/Q4_0-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c246fd944650deca78e832bddd3b69013db9f9b49ba97afe21831ecba42b669
3
+ size 7071700672
Q4_1/Q4_1-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:798a08891f5bbf76d0801f8a609cceceb10ad40b10917f1bea897ba48197dfa0
3
+ size 7795218112
Q4_K/Q4_K-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a6661cb2b0c565ae82c376f4e214a03c8e1baac6644c29409ee5e3f357b1c248
3
+ size 7477204672
Q4_K_M/Q4_K_M-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a6661cb2b0c565ae82c376f4e214a03c8e1baac6644c29409ee5e3f357b1c248
3
+ size 7477204672
Q4_K_S/Q4_K_S-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e9cc1d3c1d1523da4d1ff31b6ab5bb0e3de6aafe6e417253b2f12cc19e23d8f5
3
+ size 7120197312
Q5_0/Q5_0-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:30f61350d8c8e4200cafb2652fd6bd00f77db3ecb138ea68eea7cbe8683891e1
3
+ size 8518735552
Q5_1/Q5_1-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:babe3424ce2d2eec0ddc9a47107c4890f78d3d7636c62e19c5944877a4f0a3f6
3
+ size 9242252992
Q5_K/Q5_K-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e433d8424f0f509d8169a42f5c4cb9987c1a0f32aa7447ae6c825a33e3ef0a11
3
+ size 8727631552
Q5_K_M/Q5_K_M-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e433d8424f0f509d8169a42f5c4cb9987c1a0f32aa7447ae6c825a33e3ef0a11
3
+ size 8727631552
Q5_K_S/Q5_K_S-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:721eb64b5d89a1d9a079d907edc83c6a563ed3f478a35d6d256057837c8c2862
3
+ size 8518735552
Q6_K/Q6_K-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:48318ea51217b0c92a12314d738a5982b273c5d335c118a903c0b3a96756977a
3
+ size 10056210112
Q8_0/Q8_0-00001-of-00001.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:de77735df42ad0283609f5c4ddf40f7bc4659e0ebc9e5dfff47f77464a8a651a
3
+ size 13022369472
README.md ADDED
@@ -0,0 +1,408 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - fr
5
+ - de
6
+ - es
7
+ - it
8
+ - pt
9
+ - ru
10
+ - zh
11
+ - ja
12
+ license: apache-2.0
13
+ tags:
14
+ - GGUF
15
+ extra_gated_description: If you want to learn more about how we process your personal
16
+ data, please read our <a href="https://mistral.ai/terms/">Privacy Policy</a>.
17
+ quantized_by: andrijdavid
18
+ ---
19
+ # Mistral-Nemo-Instruct-2407-GGUF
20
+ - Original model: [Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407)
21
+
22
+ <!-- description start -->
23
+ ## Description
24
+
25
+ This repo contains GGUF format model files for [Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407).
26
+
27
+ <!-- description end -->
28
+ <!-- README_GGUF.md-about-gguf start -->
29
+ ### About GGUF
30
+ GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp.
31
+ Here is an incomplete list of clients and libraries that are known to support GGUF:
32
+ * [llama.cpp](https://github.com/ggerganov/llama.cpp). This is the source project for GGUF, providing both a Command Line Interface (CLI) and a server option.
33
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui), Known as the most widely used web UI, this project boasts numerous features and powerful extensions, and supports GPU acceleration.
34
+ * [Ollama](https://github.com/jmorganca/ollama) Ollama is a lightweight and extensible framework designed for building and running language models locally. It features a simple API for creating, managing, and executing models, along with a library of pre-built models for use in various applications​
35
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), A comprehensive web UI offering GPU acceleration across all platforms and architectures, particularly renowned for storytelling.
36
+ * [GPT4All](https://gpt4all.io), This is a free and open source GUI that runs locally, supporting Windows, Linux, and macOS with full GPU acceleration.
37
+ * [LM Studio](https://lmstudio.ai/) An intuitive and powerful local GUI for Windows and macOS (Silicon), featuring GPU acceleration.
38
+ * [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui). A notable web UI with a variety of unique features, including a comprehensive model library for easy model selection.
39
+ * [Faraday.dev](https://faraday.dev/), An attractive, user-friendly character-based chat GUI for Windows and macOS (both Silicon and Intel), also offering GPU acceleration.
40
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), A Python library equipped with GPU acceleration, LangChain support, and an OpenAI-compatible API server.
41
+ * [candle](https://github.com/huggingface/candle), A Rust-based ML framework focusing on performance, including GPU support, and designed for ease of use.
42
+ * [ctransformers](https://github.com/marella/ctransformers), A Python library featuring GPU acceleration, LangChain support, and an OpenAI-compatible AI server.
43
+ * [localGPT](https://github.com/PromtEngineer/localGPT) An open-source initiative enabling private conversations with documents.
44
+ <!-- README_GGUF.md-about-gguf end -->
45
+
46
+ <!-- compatibility_gguf start -->
47
+ ## Explanation of quantisation methods
48
+ <details>
49
+ <summary>Click to see details</summary>
50
+ The new methods available are:
51
+
52
+ * GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
53
+ * GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
54
+ * GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
55
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
56
+ * GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw.
57
+ </details>
58
+ <!-- compatibility_gguf end -->
59
+
60
+ <!-- README_GGUF.md-how-to-download start -->
61
+ ## How to download GGUF files
62
+
63
+ **Note for manual downloaders:** You almost never want to clone the entire repo! Multiple different quantisation formats are provided, and most users only want to pick and download a single folder.
64
+
65
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
66
+
67
+ * LM Studio
68
+ * LoLLMS Web UI
69
+ * Faraday.dev
70
+
71
+ ### In `text-generation-webui`
72
+
73
+ Under Download Model, you can enter the model repo: LiteLLMs/Mistral-Nemo-Instruct-2407-GGUF and below it, a specific filename to download, such as: Q4_0/Q4_0-00001-of-00001.gguf.
74
+
75
+ Then click Download.
76
+
77
+ ### On the command line, including multiple files at once
78
+
79
+ I recommend using the `huggingface-hub` Python library:
80
+
81
+ ```shell
82
+ pip3 install huggingface-hub
83
+ ```
84
+
85
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
86
+
87
+ ```shell
88
+ huggingface-cli download LiteLLMs/Mistral-Nemo-Instruct-2407-GGUF Q4_0/Q4_0-00001-of-00001.gguf --local-dir . --local-dir-use-symlinks False
89
+ ```
90
+
91
+ <details>
92
+ <summary>More advanced huggingface-cli download usage (click to read)</summary>
93
+
94
+ You can also download multiple files at once with a pattern:
95
+
96
+ ```shell
97
+ huggingface-cli download LiteLLMs/Mistral-Nemo-Instruct-2407-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
98
+ ```
99
+
100
+ For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
101
+
102
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
103
+
104
+ ```shell
105
+ pip3 install huggingface_hub[hf_transfer]
106
+ ```
107
+
108
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
109
+
110
+ ```shell
111
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download LiteLLMs/Mistral-Nemo-Instruct-2407-GGUF Q4_0/Q4_0-00001-of-00001.gguf --local-dir . --local-dir-use-symlinks False
112
+ ```
113
+
114
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
115
+ </details>
116
+ <!-- README_GGUF.md-how-to-download end -->
117
+ <!-- README_GGUF.md-how-to-run start -->
118
+ ## Example `llama.cpp` command
119
+
120
+ Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
121
+
122
+ ```shell
123
+ ./main -ngl 35 -m Q4_0/Q4_0-00001-of-00001.gguf --color -c --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<PROMPT>"
124
+ ```
125
+
126
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
127
+
128
+ Change `-c ` to the desired sequence length. For extended sequence models - eg 8K, 16K, 32K - the necessary RoPE scaling parameters are read from the GGUF file and set by llama.cpp automatically. Note that longer sequence lengths require much more resources, so you may need to reduce this value.
129
+
130
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
131
+
132
+ For other parameters and how to use them, please refer to [the llama.cpp documentation](https://github.com/ggerganov/llama.cpp/blob/master/examples/main/README.md)
133
+
134
+ ## How to run in `text-generation-webui`
135
+
136
+ Further instructions can be found in the text-generation-webui documentation, here: [text-generation-webui/docs/04 ‐ Model Tab.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/04%20%E2%80%90%20Model%20Tab.md#llamacpp).
137
+
138
+ ## How to run from Python code
139
+
140
+ You can use GGUF models from Python using the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) or [ctransformers](https://github.com/marella/ctransformers) libraries. Note that at the time of writing (Nov 27th 2023), ctransformers has not been updated for some time and is not compatible with some recent models. Therefore I recommend you use llama-cpp-python.
141
+
142
+ ### How to load this model in Python code, using llama-cpp-python
143
+
144
+ For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/).
145
+
146
+ #### First install the package
147
+
148
+ Run one of the following commands, according to your system:
149
+
150
+ ```shell
151
+ # Base ctransformers with no GPU acceleration
152
+ pip install llama-cpp-python
153
+ # With NVidia CUDA acceleration
154
+ CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
155
+ # Or with OpenBLAS acceleration
156
+ CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
157
+ # Or with CLBLast acceleration
158
+ CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
159
+ # Or with AMD ROCm GPU acceleration (Linux only)
160
+ CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
161
+ # Or with Metal GPU acceleration for macOS systems only
162
+ CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
163
+ # In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
164
+ $env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
165
+ pip install llama-cpp-python
166
+ ```
167
+
168
+ #### Simple llama-cpp-python example code
169
+
170
+ ```python
171
+ from llama_cpp import Llama
172
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
173
+ llm = Llama(
174
+ model_path="./Q4_0/Q4_0-00001-of-00001.gguf", # Download the model file first
175
+ n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
176
+ n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
177
+ n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
178
+ )
179
+ # Simple inference example
180
+ output = llm(
181
+ "<PROMPT>", # Prompt
182
+ max_tokens=512, # Generate up to 512 tokens
183
+ stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
184
+ echo=True # Whether to echo the prompt
185
+ )
186
+ # Chat Completion API
187
+ llm = Llama(model_path="./Q4_0/Q4_0-00001-of-00001.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
188
+ llm.create_chat_completion(
189
+ messages = [
190
+ {"role": "system", "content": "You are a story writing assistant."},
191
+ {
192
+ "role": "user",
193
+ "content": "Write a story about llamas."
194
+ }
195
+ ]
196
+ )
197
+ ```
198
+
199
+ ## How to use with LangChain
200
+
201
+ Here are guides on using llama-cpp-python and ctransformers with LangChain:
202
+
203
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
204
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
205
+
206
+ <!-- README_GGUF.md-how-to-run end -->
207
+
208
+ <!-- footer end -->
209
+
210
+ <!-- original-model-card start -->
211
+ # Original model card: Mistral-Nemo-Instruct-2407
212
+
213
+
214
+ # Model Card for Mistral-Nemo-Instruct-2407
215
+
216
+ 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.
217
+
218
+ For more details about this model please refer to our release [blog post](https://mistral.ai/news/mistral-nemo/).
219
+
220
+ ## Key features
221
+ - Released under the **Apache 2 License**
222
+ - Pre-trained and instructed versions
223
+ - Trained with a **128k context window**
224
+ - Trained on a large proportion of **multilingual and code data**
225
+ - Drop-in replacement of Mistral 7B
226
+
227
+ ## Model Architecture
228
+ Mistral Nemo is a transformer model, with the following architecture choices:
229
+ - **Layers:** 40
230
+ - **Dim:** 5,120
231
+ - **Head dim:** 128
232
+ - **Hidden dim:** 14,436
233
+ - **Activation Function:** SwiGLU
234
+ - **Number of heads:** 32
235
+ - **Number of kv-heads:** 8 (GQA)
236
+ - **Vocabulary size:** 2**17 ~= 128k
237
+ - **Rotary embeddings (theta = 1M)**
238
+
239
+ ## Metrics
240
+
241
+ ### Main Benchmarks
242
+
243
+ | Benchmark | Score |
244
+ | - | - | ----- |
245
+ | French | 62.3% |
246
+ | German | 62.7% |
247
+ | Spanish | 64.6% |
248
+ | Italian | 61.3% |
249
+ | Portuguese | 63.3% |
250
+ | Russian | 59.2% |
251
+ | Chinese | 59.0% |
252
+ | Japanese | 59.0% |
253
+
254
+ ## Usage
255
+
256
+ The model can be used with three different frameworks
257
+
258
+ - [`mistral_inference`](https://github.com/mistralai/mistral-inference): See [here](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407#mistral-inference)
259
+ - [`transformers`](https://github.com/huggingface/transformers): See [here](#transformers)
260
+ - [`NeMo`](https://github.com/NVIDIA/NeMo): See [nvidia/Mistral-NeMo-12B-Instruct](https://huggingface.co/nvidia/Mistral-NeMo-12B-Instruct)
261
+
262
+ ### Mistral Inference
263
+
264
+ #### Install
265
+
266
+ 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.
267
+
268
+ ```
269
+ pip install mistral_inference
270
+ ```
271
+
272
+ #### Download
273
+
274
+ ```py
275
+ from huggingface_hub import snapshot_download
276
+ from pathlib import Path
277
+
278
+ mistral_models_path = Path.home().joinpath('mistral_models', 'Nemo-Instruct')
279
+ mistral_models_path.mkdir(parents=True, exist_ok=True)
280
+
281
+ snapshot_download(repo_id="mistralai/Mistral-Nemo-Instruct-2407", allow_patterns=["params.json", "consolidated.safetensors", "tekken.json"], local_dir=mistral_models_path)
282
+ ```
283
+
284
+ #### Chat
285
+
286
+ After installing `mistral_inference`, a `mistral-chat` CLI command should be available in your environment. You can chat with the model using
287
+
288
+ ```
289
+ mistral-chat $HOME/mistral_models/Nemo-Instruct --instruct --max_tokens 256 --temperature 0.35
290
+ ```
291
+
292
+ *E.g.* Try out something like:
293
+ ```
294
+ How expensive would it be to ask a window cleaner to clean all windows in Paris. Make a reasonable guess in US Dollar.
295
+ ```
296
+
297
+ #### Instruct following
298
+
299
+ ```py
300
+ from mistral_inference.transformer import Transformer
301
+ from mistral_inference.generate import generate
302
+
303
+ from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
304
+ from mistral_common.protocol.instruct.messages import UserMessage
305
+ from mistral_common.protocol.instruct.request import ChatCompletionRequest
306
+
307
+ tokenizer = MistralTokenizer.from_file(f"{mistral_models_path}/tekken.json")
308
+ model = Transformer.from_folder(mistral_models_path)
309
+
310
+ prompt = "How expensive would it be to ask a window cleaner to clean all windows in Paris. Make a reasonable guess in US Dollar."
311
+
312
+ completion_request = ChatCompletionRequest(messages=[UserMessage(content=prompt)])
313
+
314
+ tokens = tokenizer.encode_chat_completion(completion_request).tokens
315
+
316
+ out_tokens, _ = generate([tokens], model, max_tokens=64, temperature=0.35, eos_id=tokenizer.instruct_tokenizer.tokenizer.eos_id)
317
+ result = tokenizer.decode(out_tokens[0])
318
+
319
+ print(result)
320
+ ```
321
+
322
+ #### Function calling
323
+
324
+ ```py
325
+ from mistral_common.protocol.instruct.tool_calls import Function, Tool
326
+ from mistral_inference.transformer import Transformer
327
+ from mistral_inference.generate import generate
328
+
329
+ from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
330
+ from mistral_common.protocol.instruct.messages import UserMessage
331
+ from mistral_common.protocol.instruct.request import ChatCompletionRequest
332
+
333
+
334
+ tokenizer = MistralTokenizer.from_file(f"{mistral_models_path}/tekken.json")
335
+ model = Transformer.from_folder(mistral_models_path)
336
+
337
+ completion_request = ChatCompletionRequest(
338
+ tools=[
339
+ Tool(
340
+ function=Function(
341
+ name="get_current_weather",
342
+ description="Get the current weather",
343
+ parameters={
344
+ "type": "object",
345
+ "properties": {
346
+ "location": {
347
+ "type": "string",
348
+ "description": "The city and state, e.g. San Francisco, CA",
349
+ },
350
+ "format": {
351
+ "type": "string",
352
+ "enum": ["celsius", "fahrenheit"],
353
+ "description": "The temperature unit to use. Infer this from the users location.",
354
+ },
355
+ },
356
+ "required": ["location", "format"],
357
+ },
358
+ )
359
+ )
360
+ ],
361
+ messages=[
362
+ UserMessage(content="What's the weather like today in Paris?"),
363
+ ],
364
+ )
365
+
366
+ tokens = tokenizer.encode_chat_completion(completion_request).tokens
367
+
368
+ out_tokens, _ = generate([tokens], model, max_tokens=256, temperature=0.35, eos_id=tokenizer.instruct_tokenizer.tokenizer.eos_id)
369
+ result = tokenizer.decode(out_tokens[0])
370
+
371
+ print(result)
372
+ ```
373
+
374
+ ### Transformers
375
+
376
+ > [!IMPORTANT]
377
+ > NOTE: Until a new release has been made, you need to install transformers from source:
378
+ > ```sh
379
+ > pip install git+https://github.com/huggingface/transformers.git
380
+ > ```
381
+
382
+ If you want to use Hugging Face `transformers` to generate text, you can do something like this.
383
+
384
+ ```py
385
+ from transformers import pipeline
386
+
387
+ messages = [
388
+ {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
389
+ {"role": "user", "content": "Who are you?"},
390
+ ]
391
+ chatbot = pipeline("text-generation", model="mistralai/Mistral-Nemo-Instruct-2407")
392
+ chatbot(messages)
393
+ ```
394
+
395
+ > [!TIP]
396
+ > Unlike previous Mistral models, Mistral Nemo requires smaller temperatures. We recommend to use a temperature of 0.3.
397
+
398
+ ## Limitations
399
+
400
+ The Mistral Nemo Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
401
+ It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to
402
+ make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.
403
+
404
+ ## The Mistral AI Team
405
+
406
+ 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
407
+
408
+ <!-- original-model-card end -->