📋 Model Description


license: apache-2.0
language:
- en
- fr
- de
- es
- it
- pt
- ru
- zh
- ja


QuantFactory/Mistral-Nemo-Instruct-2407-GGUF

This is quantized version of mistralai/Mistral-Nemo-Instruct-2407 created using llama.cpp release b3438.

Original Model Card

Model Card for Mistral-Nemo-Instruct-2407

The Mistral-Nemo-Instruct-2407 Large Language Model (LLM) is an instruct fine-tuned version of the Mistral-Nemo-Base-2407. Trained jointly by Mistral AI and NVIDIA, it significantly outperforms existing models smaller or similar in size.

For more details about this model please refer to our release blog post.

Key features

  • Released under the Apache 2 License
  • Pre-trained and instructed versions
  • Trained with a 128k context window
  • Trained on a large proportion of multilingual and code data
  • Drop-in replacement of Mistral 7B

Model Architecture

Mistral Nemo is a transformer model, with the following architecture choices:
  • Layers: 40
  • Dim: 5,120
  • Head dim: 128
  • Hidden dim: 14,436
  • Activation Function: SwiGLU
  • Number of heads: 32
  • Number of kv-heads: 8 (GQA)
  • Vocabulary size: 217 ~= 128k
  • Rotary embeddings (theta = 1M)

Metrics

Main Benchmarks

BenchmarkScore
HellaSwag (0-shot)83.5%
Winogrande (0-shot)76.8%
OpenBookQA (0-shot)60.6%
CommonSenseQA (0-shot)70.4%
TruthfulQA (0-shot)50.3%
MMLU (5-shot)68.0%
TriviaQA (5-shot)73.8%
NaturalQuestions (5-shot)31.2%

Multilingual Benchmarks (MMLU)

LanguageScore
French62.3%
German62.7%
Spanish64.6%
Italian61.3%
Portuguese63.3%
Russian59.2%
Chinese59.0%
Japanese59.0%

Usage

The model can be used with three different frameworks

Mistral Inference

#### Install

It is recommended to use mistralai/Mistral-Nemo-Instruct-2407 with mistral-inference. For HF transformers code snippets, please keep scrolling.

pip install mistral_inference

#### Download

from huggingfacehub import snapshotdownload
from pathlib import Path

mistralmodelspath = Path.home().joinpath('mistral_models', 'Nemo-Instruct')
mistralmodelspath.mkdir(parents=True, exist_ok=True)

snapshotdownload(repoid="mistralai/Mistral-Nemo-Instruct-2407", allowpatterns=["params.json", "consolidated.safetensors", "tekken.json"], localdir=mistralmodelspath)

#### Chat

After installing mistral_inference, a mistral-chat CLI command should be available in your environment. You can chat with the model using

mistral-chat $HOME/mistralmodels/Nemo-Instruct --instruct --maxtokens 256 --temperature 0.35

E.g. Try out something like:

How expensive would it be to ask a window cleaner to clean all windows in Paris. Make a reasonable guess in US Dollar.

#### Instruct following

from mistral_inference.transformer import Transformer
from mistral_inference.generate import generate

from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
from mistral_common.protocol.instruct.messages import UserMessage
from mistral_common.protocol.instruct.request import ChatCompletionRequest

tokenizer = MistralTokenizer.fromfile(f"{mistralmodels_path}/tekken.json")
model = Transformer.fromfolder(mistralmodels_path)

prompt = "How expensive would it be to ask a window cleaner to clean all windows in Paris. Make a reasonable guess in US Dollar."

completion_request = ChatCompletionRequest(messages=[UserMessage(content=prompt)])

tokens = tokenizer.encodechatcompletion(completion_request).tokens

outtokens, = generate([tokens], model, maxtokens=64, temperature=0.35, eosid=tokenizer.instructtokenizer.tokenizer.eosid)
result = tokenizer.decode(out_tokens[0])

print(result)

#### Function calling

from mistralcommon.protocol.instruct.toolcalls import Function, Tool
from mistral_inference.transformer import Transformer
from mistral_inference.generate import generate

from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
from mistral_common.protocol.instruct.messages import UserMessage
from mistral_common.protocol.instruct.request import ChatCompletionRequest

tokenizer = MistralTokenizer.fromfile(f"{mistralmodels_path}/tekken.json")
model = Transformer.fromfolder(mistralmodels_path)

completion_request = ChatCompletionRequest(
tools=[
Tool(
function=Function(
name="getcurrentweather",
description="Get the current weather",
parameters={
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA",
},
"format": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"description": "The temperature unit to use. Infer this from the users location.",
},
},
"required": ["location", "format"],
},
)
)
],
messages=[
UserMessage(content="What's the weather like today in Paris?"),
],
)

tokens = tokenizer.encodechatcompletion(completion_request).tokens

outtokens, = generate([tokens], model, maxtokens=256, temperature=0.35, eosid=tokenizer.instructtokenizer.tokenizer.eosid)
result = tokenizer.decode(out_tokens[0])

print(result)

Transformers

[!IMPORTANT]

NOTE: Until a new release has been made, you need to install transformers from source:

> pip install git+https://github.com/huggingface/transformers.git

>

If you want to use Hugging Face transformers to generate text, you can do something like this.

from transformers import pipeline

messages = [
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
{"role": "user", "content": "Who are you?"},
]
chatbot = pipeline("text-generation", model="mistralai/Mistral-Nemo-Instruct-2407")
chatbot(messages)

[!TIP]

Unlike previous Mistral models, Mistral Nemo requires smaller temperatures. We recommend to use a temperature of 0.3.

Limitations

The Mistral Nemo Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to
make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.

The Mistral AI Team

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

📂 GGUF File List

📁 Filename 📦 Size ⚡ Download
Mistral-Nemo-Instruct-2407.Q2_K.gguf
LFS Q2
4.46 GB Download
Mistral-Nemo-Instruct-2407.Q3_K_L.gguf
LFS Q3
6.11 GB Download
Mistral-Nemo-Instruct-2407.Q3_K_M.gguf
LFS Q3
5.67 GB Download
Mistral-Nemo-Instruct-2407.Q3_K_S.gguf
LFS Q3
5.15 GB Download
Mistral-Nemo-Instruct-2407.Q4_0.gguf
Recommended LFS Q4
6.59 GB Download
Mistral-Nemo-Instruct-2407.Q4_1.gguf
LFS Q4
7.26 GB Download
Mistral-Nemo-Instruct-2407.Q4_K_M.gguf
LFS Q4
6.96 GB Download
Mistral-Nemo-Instruct-2407.Q4_K_S.gguf
LFS Q4
6.63 GB Download
Mistral-Nemo-Instruct-2407.Q5_0.gguf
LFS Q5
7.93 GB Download
Mistral-Nemo-Instruct-2407.Q5_1.gguf
LFS Q5
8.61 GB Download
Mistral-Nemo-Instruct-2407.Q5_K_M.gguf
LFS Q5
8.13 GB Download
Mistral-Nemo-Instruct-2407.Q5_K_S.gguf
LFS Q5
7.93 GB Download
Mistral-Nemo-Instruct-2407.Q6_K.gguf
LFS Q6
9.37 GB Download
Mistral-Nemo-Instruct-2407.Q8_0.gguf
LFS Q8
12.13 GB Download