/ Модель

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

Контекст
131 072 токена
Параметры
7,1 млрд
Размер весов
14,5 ГБ
Лицензия
Apache 2.0
Архитектура
mistral · dense
Опубликована
2 апр 2024

buddhi-128k-chat-7b

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

Диалоговая модель AI Planet на базе Mistral 7B для генерации текста и ответов по длинному контексту до 128K токенов.

133скачиваний за 30 дней18лайковвеса обновлены15 авг 2024

Бенчмарки

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

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

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

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

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

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

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

Buddhi-128K-Chat — диалоговая языковая модель общего назначения от AI Planet, дообученная на базе Mistral-7B-Instruct-v0.2. Она предназначена для генерации ответов, работы с длинными документами и продолжительными диалогами: в частности, для суммаризации, генерации текста и ответов на вопросы по большому контексту.

Модель использует плотную архитектуру MistralForCausalLM с 7,1 млрд параметров и контекстным окном до 131 072 токенов. Для расширения контекста применена техника YaRN; README также описывает Dynamic-YARN. Модель принимает текст и генерирует текст, поддерживает английский язык и использует шаблон инструкций Mistral с маркерами [INST] и [/INST].

Для запуска с контекстом 128K в карточке указано требование около 80 ГБ VRAM, а для 32K — около 40 ГБ; рекомендуется A100. Модель опубликована в формате safetensors под лицензией Apache-2.0. Приведённые в README результаты бенчмарков не являются независимой оценкой, а обработка максимального контекста требует значительных ресурсов.

Сценарии применения

  • суммаризация длинных документов
  • ответы на вопросы по объёмным документам
  • генерация текста с учётом длинного контекста
  • поддержание продолжительных диалогов

Ограничения

Для работы с контекстом 128K требуется около 80 ГБ видеопамяти, а с контекстом 32K — около 40 ГБ. Результаты бенчмарков в карточке приведены разработчиком и не являются независимой оценкой.

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

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

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

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

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

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

Открыть на Hugging Face

Buddhi-128K-Chat (7B) vLLM Inference: Open In Colab

Read release article: 🔗 Introducing Buddhi: Open-Source Chat Model with a 128K Context Window 🔗

4.png

Model Description

Buddhi-128k-Chat is a general-purpose first chat model with 128K context length window. It is meticulously fine-tuned on the Mistral 7B Instruct, and optimised to handle an extended context length of up to 128,000 tokens using the innovative YaRN (Yet another Rope Extension) Technique. This enhancement allows Buddhi to maintain a deeper understanding of context in long documents or conversations, making it particularly adept at tasks requiring extensive context retention, such as comprehensive document summarization, detailed narrative generation, and intricate question-answering.

Architecture

The Buddhi-128K-Chat model is fine-tuned on the Mistral-7B Instruct base model. We selected the Mistral 7B Instruct v0.2 as the parent model due to its superior reasoning capabilities. The architecture of the Mistral-7B model includes features like Grouped-Query Attention and Byte-fallback BPE tokenizer. Originally, this model has 32,768 maximum position embeddings. To increase the context size to 128K, we needed to modify the positional embeddings, which is where YaRN comes into play.

In our approach, we utilized the NTK-aware technique, which recommends alternative interpolation techniques for positional interpolation. One experimentation involved Dynamic-YARN, suggesting the dynamic value of the 's' scale factor. This is because during inference, the sequence length changes by 1 after every word prediction. By integrating these position embeddings with the Mistral-7B Instruct base model, we achieved the 128K model.

Additionally, we fine-tuned the model on our dataset to contribute one of the very few 128K chat-based models available in the open-source community with greater reasoning capabilities than all of it.

Hardware requirements:

For 128k Context Length

  • 80GB VRAM - A100 Preferred

For 32k Context Length

  • 40GB VRAM - A100 Preferred

vLLM - For Faster Inference

Installation

!pip install vllm
!pip install flash_attn # If Flash Attention 2 is supported by your System

Please check out Flash Attention 2 Github Repository for more instructions on how to Install it.

Implementation:

Note: The actual hardware requirements to run the model is roughly around 70GB VRAM. For experimentation, we are limiting the context length to 75K instead of 128K. This make it suitable for testing the model in 30-35 GB VRAM

from vllm import LLM, SamplingParams

llm = LLM(
    model='aiplanet/buddhi-128k-chat-7b',
    trust_remote_code=True,
    dtype = 'bfloat16',
    gpu_memory_utilization=1,
    max_model_len= 75000 
)

prompts = [
  """<s> [INST] Please tell me a joke. [/INST] """,
  """<s> [INST] What is Machine Learning? [/INST] """
]

sampling_params = SamplingParams(
  temperature=0.8,
  top_p=0.95,
  max_tokens=1000
)

outputs = llm.generate(prompts, sampling_params)

for output in outputs:
    prompt = output.prompt
    generated_text = output.outputs[0].text
    print(generated_text)
    print("\n\n")

# we have also attached a colab notebook, that contains: 2 more experimentations: Long Essay and Entire Book

For Output, do check out the colab notebook: Open In Colab

Transformers - Basic Implementation

import torch
import transformers
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig

bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_use_double_quant=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.bfloat16
)

model_name = "aiplanet/Buddhi-128K-Chat"

model = AutoModelForCausalLM.from_pretrained(
  model_name,
  quantization_config=bnb_config,
  device_map="sequential",
  trust_remote_code=True
)

tokenizer = AutoTokenizer.from_pretrained(
  model,
  trust_remote_code=True
)

prompt = "<s> [INST] Please tell me a small joke. [/INST] "

tokens = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(
  **tokens,
  max_new_tokens=100,
  do_sample=True,
  top_p=0.95,
  temperature=0.8,
)

decoded_output = tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True)[0]
print(f"Output:\n{decoded_output[len(prompt):]}")

Output

Output:
Why don't scientists trust atoms?

Because they make up everything.

Prompt Template for Buddi-128-Chat

In order to leverage instruction fine-tuning, your prompt should be surrounded by [INST] and [/INST] tokens. The very first instruction should begin with a begin of sentence id. The next instructions should not. The assistant generation will be ended by the end-of-sentence token id.

"<s>[INST] What is your favourite condiment? [/INST]"
"Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!</s> "
"[INST] Do you have mayonnaise recipes? [/INST]"

Benchmarks

Long Context Benchmark

LongICLBench Banking77

Model1R/2k2R/4K3R/7K4R/9K5R/14K
aiplanet/buddhi-128k-chat-7b47.860.857.862.457.2
NousResearch/Yarn-Mistral-7b-128k31.668.6684765.6
CallComply/zephyr-7b-beta-128k40.241.233.6030
Eric111/Yarn-Mistral-7b-128k-DPO28.662.85841.659.8

Short Context Benchmark

Model# ParamsAverageARC (25-shot)HellaSwag (10-shot)Winogrande (5-shot)TruthfulOA (0-shot)MMLU (5-shot)
aiplanet/buddhi-128k-chat-7b7B64.4260.848477.2765.7260.42
migtissera/Tess-XS-vl-3-yarn-128K7B62.6661.0982.9574.4350.1362.15
migtissera/Tess-XS-v1-3-yarn-128K7B62.4961.682.9674.7450.262.1
Eric111/Yarn-Mistral-7b-128k-DPO7B60.1560.8482.9978.343.5563.09
NousResearch/Yam-Mistral-7b-128k7B59.4259.6482.576.9541.7863.02
CallComply/openchat-3.5-0106-128k7B59.3864.2577.3177.6646.557.58
CallComply/zephyr-7b-beta-128k7B54.4558.288174.7446.153.57

Get in Touch

You can schedule a 1:1 meeting with our DevRel & Community Team to get started with AI Planet Open Source LLMs and GenAI Stack. Schedule the call here: https://calendly.com/jaintarun

Stay tuned for more updates and be a part of the coding evolution. Join us on this exciting journey as we make AI accessible to all at AI Planet!

Framework versions

  • Transformers 4.39.2
  • Pytorch 2.2.1+cu121
  • Datasets 2.18.0
  • Accelerate 0.27.2
  • flash_attn 2.5.6

Citation

@misc {Chaitanya890, lucifertrj ,
   author       = { Chaitanya Singhal, Tarun Jain },
   title        = { Buddhi-128k-Chat by AI Planet},
   year         = 2024,
   url          = { https://huggingface.co/aiplanet//Buddhi-128K-Chat },
   publisher    = { Hugging Face }
}

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

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

GPU в ailist

Универсальный рантайм

Можно запустить

Подбираем GPU…

Класс архитектуры
MistralForCausalLM
Ревизия весов
4975b81

0 моделей