/ Модель

Характеристики

Лицензия
Apache 2.0
Базовая модель
Mistral-Nemo-Instruct-2407
Опубликована
4 авг 2024

Mistral-Nemo-Instruct-2407-SOTA-GGUF

Генерация текстаТекст → текст13 профессий

CISCai/Mistral-Nemo-Instruct-2407-SOTA-GGUF — это набор квантизированных моделей в формате GGUF на основе Mistral-Nemo-Instruct-2407, разработанной Mistral AI.

472скачиваний за 30 дней0лайковвеса обновлены16 авг 2024

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Квантизацию выполнил CISC с использованием importance matrix, обученной примерно на 1 млн токенов. Модель предназначена для генерации текста и диалоговых сценариев, включая использование через llama.cpp, сторонние графические интерфейсы и библиотеки, совместимые с актуальными версиями llama.cpp.

Модель поддерживает текстовую модальность и английский язык. Встроенный шаблон чата Mistral Tekken включает поддержку function calling через OpenAI-совместимый параметр tools; также были исправлены связанные с tool calls проблемы токенизации и шаблона чата. Репозиторий содержит варианты квантизации IQ1_S, IQ1_M, IQ2, IQ3 и IQ4 с эффективной разрядностью примерно от 1,56 до 4,5 бит на вес и размером файлов примерно от 2,8 ГБ, что позволяет выбирать между экономией памяти и качеством.

Главное преимущество набора — возможность локального запуска при ограниченных ресурсах и наличие вариантов с разным компромиссом между размером, требованиями к оперативной памяти и качеством. Низкоразрядные варианты характеризуются существенной или высокой потерей качества, поэтому для более требовательных задач предпочтительны более точные варианты. Файлы совместимы с llama.cpp начиная с версии от 22 июля 2024 года, включая commit 50e0535. Модель распространяется по лицензии Apache-2.0.

Для каких профессий подходит13

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Mistral-Nemo-Instruct-2407 - SOTA GGUF

Description

This repo contains State Of The Art quantized GGUF format model files for Mistral-Nemo-Instruct-2407.

August 16th update: Updated offical chat template (tool_calls fixed when None), removed silly tool_call_id length restriction and added padding token.

Quantization was done with an importance matrix that was trained for ~1M tokens (256 batches of 4096 tokens) of groups_merged-enhancedV3.txt and wiki.train.raw concatenated.

The embedded chat template is the updated one with correct Tekken tokenization and function calling support via OpenAI-compatible tools parameter, see example.

Prompt template: Mistral Tekken

[AVAILABLE_TOOLS][{"name": "function_name", "description": "Description", "parameters": {...}}, ...][/AVAILABLE_TOOLS][INST]{prompt}[/INST]

Compatibility

These quantised GGUFv3 files are compatible with llama.cpp from July 22nd 2024 onwards, as of commit 50e0535

They are also compatible with many third party UIs and libraries provided they are built using a recent llama.cpp.

Explanation of quantisation methods

The new methods available are:

  • GGML_TYPE_IQ1_S - 1-bit quantization in super-blocks with an importance matrix applied, effectively using 1.56 bits per weight (bpw)
  • GGML_TYPE_IQ1_M - 1-bit quantization in super-blocks with an importance matrix applied, effectively using 1.75 bpw
  • GGML_TYPE_IQ2_XXS - 2-bit quantization in super-blocks with an importance matrix applied, effectively using 2.06 bpw
  • GGML_TYPE_IQ2_XS - 2-bit quantization in super-blocks with an importance matrix applied, effectively using 2.31 bpw
  • GGML_TYPE_IQ2_S - 2-bit quantization in super-blocks with an importance matrix applied, effectively using 2.5 bpw
  • GGML_TYPE_IQ2_M - 2-bit quantization in super-blocks with an importance matrix applied, effectively using 2.7 bpw
  • GGML_TYPE_IQ3_XXS - 3-bit quantization in super-blocks with an importance matrix applied, effectively using 3.06 bpw
  • GGML_TYPE_IQ3_XS - 3-bit quantization in super-blocks with an importance matrix applied, effectively using 3.3 bpw
  • GGML_TYPE_IQ3_S - 3-bit quantization in super-blocks with an importance matrix applied, effectively using 3.44 bpw
  • GGML_TYPE_IQ3_M - 3-bit quantization in super-blocks with an importance matrix applied, effectively using 3.66 bpw
  • GGML_TYPE_IQ4_XS - 4-bit quantization in super-blocks with an importance matrix applied, effectively using 4.25 bpw
  • GGML_TYPE_IQ4_NL - 4-bit non-linearly mapped quantization with an importance matrix applied, effectively using 4.5 bpw

Refer to the Provided Files table below to see what files use which methods, and how.

Provided files

NameQuant methodBitsSizeMax RAM requiredUse case
Mistral-Nemo-Instruct-2407.IQ1_S.ggufIQ1_S12.8 GB3.4 GBsmallest, significant quality loss
Mistral-Nemo-Instruct-2407.IQ1_M.ggufIQ1_M13.0 GB3.6 GBvery small, significant quality loss
Mistral-Nemo-Instruct-2407.IQ2_XXS.ggufIQ2_XXS23.3 GB3.9 GBvery small, high quality loss
Mistral-Nemo-Instruct-2407.IQ2_XS.ggufIQ2_XS23.6 GB4.2 GBvery small, high quality loss
Mistral-Nemo-Instruct-2407.IQ2_S.ggufIQ2_S23.9 GB4.4 GBsmall, substantial quality loss
Mistral-Nemo-Instruct-2407.IQ2_M.ggufIQ2_M24.1 GB4.7 GBsmall, greater quality loss
Mistral-Nemo-Instruct-2407.IQ3_XXS.ggufIQ3_XXS34.6 GB5.2 GBvery small, high quality loss
Mistral-Nemo-Instruct-2407.IQ3_XS.ggufIQ3_XS34.9 GB5.5 GBsmall, substantial quality loss
Mistral-Nemo-Instruct-2407.IQ3_S.ggufIQ3_S35.2 GB5.8 GBsmall, greater quality loss
Mistral-Nemo-Instruct-2407.IQ3_M.ggufIQ3_M35.3 GB5.9 GBmedium, balanced quality - recommended
Mistral-Nemo-Instruct-2407.IQ4_XS.ggufIQ4_XS46.3 GB6.9 GBsmall, substantial quality loss

Generated importance matrix file: Mistral-Nemo-Instruct-2407.imatrix.dat

Note: the above RAM figures assume no GPU offloading with 4K context. If layers are offloaded to the GPU, this will reduce RAM usage and use VRAM instead.

Example llama.cpp command

Make sure you are using llama.cpp from commit 50e0535 or later.

./llama-cli -ngl 41 -m Mistral-Nemo-Instruct-2407.IQ4_XS.gguf --color -c 131072 --temp 0.3 --repeat-penalty 1.1 -p "[AVAILABLE_TOOLS]{tools}[/AVAILABLE_TOOLS][INST]{prompt}[/INST]"

This model is very temperature sensitive, keep it between 0.3 and 0.4 for best results! Also note the lack of spaces between special tokens and input in the prompt; this model is not using the regular Mistral chat template.

Change -ngl 41 to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.

Change -c 131072 to the desired sequence length.

If you are low on V/RAM try quantizing the K-cache with -ctk q8_0 or even -ctk q4_0 for big memory savings (depending on context size). There is a similar option for V-cache (-ctv), however that is not working yet unless you enable Flash Attention (-fa) too.

For other parameters and how to use them, please refer to the llama.cpp documentation

How to run from Python code

You can use GGUF models from Python using the llama-cpp-python module.

How to load this model in Python code, using llama-cpp-python

For full documentation, please see: llama-cpp-python docs.

First install the package

Run one of the following commands, according to your system:

# Prebuilt wheel with basic CPU support
pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
# Prebuilt wheel with NVidia CUDA acceleration
pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121 (or cu122 etc.)
# Prebuilt wheel with Metal GPU acceleration
pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/metal
# Build base version with no GPU acceleration
pip install llama-cpp-python
# With NVidia CUDA acceleration
CMAKE_ARGS="-DGGML_CUDA=on" pip install llama-cpp-python
# Or with OpenBLAS acceleration
CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
# Or with AMD ROCm GPU acceleration (Linux only)
CMAKE_ARGS="-DGGML_HIPBLAS=on" pip install llama-cpp-python
# Or with Metal GPU acceleration for macOS systems only
CMAKE_ARGS="-DGGML_METAL=on" pip install llama-cpp-python
# Or with Vulkan acceleration
CMAKE_ARGS="-DGGML_VULKAN=on" pip install llama-cpp-python
# Or with SYCL acceleration
CMAKE_ARGS="-DGGML_SYCL=on -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx" pip install llama-cpp-python

# In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
$env:CMAKE_ARGS = "-DGGML_CUDA=on"
pip install llama-cpp-python

Simple llama-cpp-python example code

from llama_cpp import Llama

# Chat Completion API

llm = Llama(model_path="./Mistral-Nemo-Instruct-2407.IQ4_XS.gguf", n_gpu_layers=41, n_ctx=131072)
print(llm.create_chat_completion(
    messages = [
        {
            "role": "user",
            "content": "Pick a LeetCode challenge and solve it in Python."
        }
    ]
))

Simple llama-cpp-python example function calling code

from llama_cpp import Llama

# Chat Completion API

grammar = LlamaGrammar.from_json_schema(json.dumps({
    "type": "array",
    "items": {
        "type": "object",
        "required": [ "name", "arguments" ],
        "properties": {
            "name": {
                "type": "string"
            },
            "arguments": {
                "type": "object"
            }
        }
    }
}))

llm = Llama(model_path="./Mistral-Nemo-Instruct-2407.IQ4_XS.gguf", n_gpu_layers=41, n_ctx=131072)
response = llm.create_chat_completion(
      temperature = 0.0,
      repeat_penalty = 1.1,
      messages = [
        {
          "role": "user",
          "content": "What's the weather like in Oslo and Stockholm?"
        }
      ],
      tools=[{
        "type": "function",
        "function": {
          "name": "get_current_weather",
          "description": "Get the current weather in a given location",
          "parameters": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "description": "The city and state, e.g. San Francisco, CA"
              },
              "unit": {
                "type": "string",
                "enum": [ "celsius", "fahrenheit" ]
              }
            },
            "required": [ "location" ]
          }
        }
      }],
      grammar = grammar
)
print(json.loads(response["choices"][0]["text"]))

print(llm.create_chat_completion(
      temperature = 0.0,
      repeat_penalty = 1.1,
      messages = [
        {
          "role": "user",
          "content": "What's the weather like in Oslo?"
        },
        { # The tool_calls is from the response to the above with tool_choice active
          "role": "assistant",
          "content": None,
          "tool_calls": [
            {
              "id": "call__0_get_current_weather_cmpl-...",
              "type": "function",
              "function": {
                "name": "get_current_weather",
                "arguments": '{ "location": "Oslo, NO" ,"unit": "celsius"} '
              }
            }
          ]
        },
        { # The tool_call_id is from tool_calls and content is the result from the function call you made
          "role": "tool",
          "content": "20",
          "tool_call_id": "call__0_get_current_weather_cmpl-..."
        }
      ],
      tools=[{
        "type": "function",
        "function": {
          "name": "get_current_weather",
          "description": "Get the current weather in a given location",
          "parameters": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "description": "The city and state, e.g. San Francisco, CA"
              },
              "unit": {
                "type": "string",
                "enum": [ "celsius", "fahrenheit" ]
              }
            },
            "required": [ "location" ]
          }
        }
      }],
      #tool_choice={
      #  "type": "function",
      #  "function": {
      #    "name": "get_current_weather"
      #  }
      #}
))

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

llama.cpp

Нельзя запустить

GGUF-модель ждёт проверки: нужно выбрать файл кванта под доступные GPU.

Ревизия весов
0e014b7

0 моделей