/ Модель

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

Контекст
2 048 токенов
Размер весов
26,6 ГБ
Архитектура
extended-mpt · dense
Опубликована
23 окт 2023

extended-mind-mpt-7b-chat

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

Модель MPT-7B с механизмом внешней памяти для генерации текста и ответов с учётом переданных воспоминаний.

104скачиваний за 30 дней11лайковвеса обновлены5 июн 2024

Бенчмарки

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

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

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

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

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

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

Extended-Mind-Mpt-7b-chat — модель генерации текста, разработанная Normal Computing на основе архитектуры и кода Mosaic ML. Она сохраняет исходные веса MPT-7B без дообучения и добавляет механизм внешней памяти: во время генерации модель извлекает и использует переданные ей текстовые воспоминания в виде последовательностей token ID. Это позволяет дополнять контекст диалога внешними сведениями и обновлять набор памяти между запросами.

Модель предназначена для генерации ответов с опорой на внешний кэш ключей и значений; память можно передавать вручную или связывать с векторной базой данных. Качество представлений памяти зависит от stride при построении кэша: меньший шаг требует больше вычислений. Для загрузки требуется библиотека Transformers и параметр trust_remote_code=True. Модель распространяется по лицензии Apache 2.0; авторы отмечают, что это часть продолжающегося исследования Normal Computing.

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

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

Ограничения

Это исследовательская работа; модель требует передачи памяти в виде token ID и загрузки с trust_remote_code=True. Более мелкий stride повышает качество представлений памяти, но увеличивает вычислительные затраты.

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

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

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

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

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

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

Открыть на Hugging Face

Model Card for Extended-Mind-Mpt-7b-chat

Original architecture and code by Mosaic ML.

  • Developed by: Normal Computing, Adapted from Mosacic ML
  • License: Apache 2.0

This model is part of the Extended Mind Transformers collection, and implements the methods described in our paper. This model retrieves and attends to an external cache of key-value pairs (or memories), and has not been finetuned (The original model weights have not been edited).

Model Usage

External Memory

Passing external memories to the model is easy. Simply pass the token ids to the model during instantiation, as the following examples illustrate. Generating and caching the memories is handled internally, during the first model.generate() call. You can update the memories using the following sequence of commands:

model.clear_memories()
model.memory_ids = list_of_new_token_ids

Set trust_remote_code=True to avoid warnings. Pass the memories to the model as a list of token ids.

from transformers import AutoModelForCausalLM, AutoTokenizer

ag_wiki_entry = """Alexander Grothendieck (/ˈɡroʊtəndiːk/; German pronunciation: [ˌalɛˈksandɐ ˈɡʁoːtn̩ˌdiːk] (listen); French: [ɡʁɔtɛndik]; 28 March 1928 – 13 November 2014) was a stateless (and then, since 1971, French) mathematician who became the leading figure in the creation of modern algebraic geometry.[7][8] His research extended the scope of the field and added elements of commutative algebra, homological algebra, sheaf theory, and category theory to its foundations, while his so-called "relative" perspective led to revolutionary advances in many areas of pure mathematics.[7][9] He is considered by many to be the greatest mathematician of the twentieth century.[10][11]"""

tokenizer_hf = AutoTokenizer.from_pretrained("normalcomputing/extended-mind-mpt-7b-chat")
memories = tokenizer_hf(ag_wiki_entry).input_ids

model_hf = AutoModelForCausalLM.from_pretrained("normalcomputing/extended-mind-mpt-7b-chat", external_memories=memories, trust_remote_code=True)

After this, you can generate text with the model as usual. The model will automatically use the memories during generation. You can update any config parameters (we set topk below) by passing new values to the model.generate() method.

inputs = "When did Alexander Grothendieck become a French citizen?"
inputs = tokenizer(inputs, return_tensors="pt").input_ids

outputs = model.generate(inputs, max_length=40, topk=2)
tokenizer.decode(outputs_hf['sequences'][0], skip_special_tokens=True)

Citations

By simply setting output_retrieved_memory_idx=True in the model.generate() method, you can retrieve the memory indices used during generation. We walk through an example in the demo notebook.

Additional configuration

LongLLaMA has several other parameters:

  • memory_type (string, optional, defaults to manual): Whether to store external memories manually or in a vector database.
  • mask_by_sim (bool, optional, defaults to True): Whether or not to mask retrieved memories by similarity.
  • sim_threshold (float, optional, defaults to 0.25): Threshold for masking retrieved memories.
  • tokenizer_all_special_ids (list, optional, defaults to [0, 50278]): Ids for special tokens to remove from memories.
  • remove_special_tokens (bool, optional, defaults to True): Remove memories that correspond to tokenizer special ids.

Additionally, the stride used to compute the memory representations can be set within generate_cache() method. Smaller strides generate higher-quality representations, while larger strides require fewer computations.

Limitations

This model is part of ongoing research at Normal Computing.

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

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

GPU в ailist

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

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

Модели нужен код из репозитория; автор пока не в списке доверенных организаций.

Класс архитектуры
ExtendedMptForCausalLM
Ревизия весов
e5bfae0

0 моделей