/ Модель

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

Контекст
32 768 токенов
Параметры
6,6 млрд
Размер весов
13,5 ГБ
Лицензия
Llama 2
Архитектура
llama · dense
Библиотека
transformers
Опубликована
26 июл 2023

LLaMA-2-7B-32K

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

Англоязычная модель Together на основе Llama 2 7B с контекстом до 32 768 токенов для генерации текста, ответов по документам и суммаризации.

2 419скачиваний за 30 дней537лайковвеса обновлены28 мар 2024

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

  • BBH

    BBH Raw · выше — лучше

    Результат

    0,34

    Open LLM v2 · архив

    Публичная таблицаревизия совпадает

  • GPQA

    GPQA Raw · выше — лучше

    Результат

    0,25

    Open LLM v2 · архив

    Публичная таблицаревизия совпадает

  • MMLU-PRO

    MMLU-PRO Raw · выше — лучше

    Результат

    0,1768

    Open LLM v2 · архив

    Публичная таблицаревизия совпадает

  • MUSR

    MUSR Raw · выше — лучше

    Результат

    0,3754

    Open LLM v2 · архив

    Публичная таблицаревизия совпадает

  • IFEval

    IFEval Raw · выше — лучше

    Результат

    0,1865

    Open LLM v2 · архив

    Публичная таблицаревизия совпадает

  • MATH Lvl 5

    MATH Lvl 5 Raw · выше — лучше

    Результат

    0,0144

    Open LLM v2 · архив

    Публичная таблицаревизия совпадает

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

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

LLaMA-2-7B-32K — языковая модель с длинным контекстом, разработанная Together и дообученная на основе Meta Llama 2 7B. Это плотная авторегрессионная модель семейства Llama, содержащая 6,6 млрд параметров и поддерживающая контекст до 32 768 токенов благодаря интерполяции позиционных представлений. Для обучения использовались смеси данных RedPajama, The Pile, UL2 Oscar и наборов для instruction tuning.

Модель предназначена для генерации текста с большим объёмом входного контекста: ответов на вопросы по нескольким документам, суммаризации длинных текстов и работы с примерами в контексте. README описывает англоязычные данные и сценарии; метаданные также указывают английский язык. Модель доступна в формате PyTorch через Transformers и подходит для дальнейшей адаптации под конкретные задачи.

Модель может выдавать неверную или предвзятую информацию. Лицензия — Llama 2; условия использования определяются лицензией Meta Llama 2.

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

  • ответы на вопросы по нескольким длинным документам
  • суммаризация глав книг и длинных текстов
  • генерация текста с длинным контекстом
  • few-shot-примеры в контексте до 32K токенов

Ограничения

Модель может генерировать неверную или предвзятую информацию. Англоязычные данные и приведённые сценарии не подтверждают поддержку других языков.

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

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

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

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

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

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

Открыть на Hugging Face

LLaMA-2-7B-32K

Model Description

LLaMA-2-7B-32K is an open-source, long context language model developed by Together, fine-tuned from Meta's original Llama-2 7B model. This model represents our efforts to contribute to the rapid progress of the open-source ecosystem for large language models. The model has been extended to a context length of 32K with position interpolation, allowing applications on multi-document QA, long text summarization, etc.

What's new?

This model introduces several improvements and new features:

  1. Extended Context: The model has been trained to handle context lengths up to 32K, which is a significant improvement over the previous versions.

  2. Pre-training and Instruction Tuning: We have shared our data recipe, which consists of a mixture of pre-training and instruction tuning data.

  3. Fine-tuning Examples: We provide examples of how to fine-tune the model for specific applications, including book summarization and long context question and answering.

  4. Software Support: We have updated both the inference and training stack to allow efficient inference and fine-tuning for 32K context.

Model Architecture

The model follows the architecture of Llama-2-7B and extends it to handle a longer context. It leverages the recently released FlashAttention-2 and a range of other optimizations to improve the speed and efficiency of inference and training.

Training and Fine-tuning

The model has been trained using a mixture of pre-training and instruction tuning data.

  • In the first training phase of continued pre-training, our data mixture contains 25% RedPajama Book, 25% RedPajama ArXiv (including abstracts), 25% other data from RedPajama, and 25% from the UL2 Oscar Data, which is a part of OIG (Open-Instruction-Generalist), asking the model to fill in missing chunks, or complete the text. To enhance the long-context ability, we exclude data shorter than 2K word. The inclusion of UL2 Oscar Data is effective in compelling the model to read and utilize long-range context.
  • We then fine-tune the model to focus on its few shot capacity under long context, including 20% Natural Instructions (NI), 20% Public Pool of Prompts (P3), 20% the Pile. We decontaminated all data against HELM core scenarios . We teach the model to leverage the in-context examples by packing examples into one 32K-token sequence. To maintain the knowledge learned from the first piece of data, we incorporate 20% RedPajama-Data Book and 20% RedPajama-Data ArXiv.

Next, we provide examples of how to fine-tune the model for specific applications. The example datasets are placed in togethercomputer/Long-Data-Collections You can use the OpenChatKit to fine-tune your own 32K model over LLaMA-2-7B-32K. Please refer to OpenChatKit for step-by-step illustrations.

  1. Long Context QA.

    We take as an example the multi-document question answering task from the paper “Lost in the Middle: How Language Models Use Long Contexts”. The input for the model consists of (i) a question that requires an answer and (ii) k documents, which are passages extracted from Wikipedia. Notably, only one of these documents contains the answer to the question, while the remaining k − 1 documents, termed as "distractor" documents, do not. To successfully perform this task, the model must identify and utilize the document containing the answer from its input context.

    With OCK, simply run the following command to fine-tune:

    bash training/finetune_llama-2-7b-32k-mqa.sh
    
  2. Summarization.

    Another example is BookSum, a unique dataset designed to address the challenges of long-form narrative summarization. This dataset features source documents from the literature domain, including novels, plays, and stories, and offers human-written, highly abstractive summaries. We here focus on chapter-level data. BookSum poses a unique set of challenges, necessitating that the model comprehensively read through each chapter.

    With OCK, simply run the following command to fine-tune:

    bash training/finetune_llama-2-7b-32k-booksum.sh
    

Inference

You can use the Together API to try out LLaMA-2-7B-32K for inference. The updated inference stack allows for efficient inference.

To run the model locally, we strongly recommend to install Flash Attention V2, which is necessary to obtain the best performance:

# Please update the path of `CUDA_HOME`
export CUDA_HOME=/usr/local/cuda-11.8
pip install transformers==4.31.0
pip install sentencepiece
pip install ninja
pip install flash-attn --no-build-isolation
pip install git+https://github.com/HazyResearch/flash-attention.git#subdirectory=csrc/rotary

You can use this model directly from the Hugging Face Model Hub or fine-tune it on your own data using the OpenChatKit.

from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("togethercomputer/LLaMA-2-7B-32K")
model = AutoModelForCausalLM.from_pretrained("togethercomputer/LLaMA-2-7B-32K", trust_remote_code=True, torch_dtype=torch.float16)

input_context = "Your text here"
input_ids = tokenizer.encode(input_context, return_tensors="pt")
output = model.generate(input_ids, max_length=128, temperature=0.7)
output_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(output_text)

Alternatively, you can set trust_remote_code=False if you prefer not to use flash attention.

Limitations and Bias

As with all language models, LLaMA-2-7B-32K may generate incorrect or biased content. It's important to keep this in mind when using the model.

Community

Join us on Together Discord

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
LlamaForCausalLM
Ревизия весов
46c24bb

0 моделей