/ Модель

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

Контекст
2 048 токенов
Параметры
1 млрд
Лицензия
Apache 2.0
Архитектура
llama · dense
Опубликована
9 мар 2024

TinyLlama_v1.1_chinese

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

Производная модели TinyLlama/TinyLlama_v1.1. Компактная англоязычная модель семейства Llama для генерации текста общего назначения при ограниченных ресурсах.

198скачиваний за 30 дней15лайковвеса обновлены7 июн 2024

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Карточка модели TinyLlama/TinyLlama_v1.1_chinese на Hugging Face совпадает с карточкой TinyLlama/TinyLlama_v1.1, поэтому описание составлено по ней.

TinyLlama_v1.1 — компактная языковая модель общего назначения, разработанная в проекте TinyLlama. Она использует плотную архитектуру Llama и тот же токенизатор и архитектуру, что и Llama 2, поэтому совместима со многими инструментами для моделей семейства Llama. В репозитории указано около 1,1 млрд параметров; метаданные классифицируют её как модель на 1 млрд параметров. Модель обучали на корпусе SlimPajama примерно на 2 трлн токенов, а её контекст составляет 2048 токенов.

Модель предназначена для генерации текста общего назначения и работы в сценариях с ограниченными вычислительными ресурсами и памятью. В README приведены результаты оценки на наборах тестов для здравого смысла и рассуждений. Карточка также описывает отдельные варианты TinyLlama для математики и кода и для китайского языка; данный репозиторий — стандартная версия общего назначения.

Модель принимает текст и генерирует текст. Метаданные указывают английский язык. Лицензия — Apache 2.0. Компактный размер облегчает запуск, но контекст ограничен 2048 токенами; README не приводит сведений о диалоговой настройке или гарантиях качества для конкретных прикладных задач.

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

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

Ограничения

Контекст ограничен 2048 токенами. В карточке описана базовая предварительно обученная модель; качество для конкретных задач и диалоговых сценариев не гарантируется.

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

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

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

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

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

Открыть на Hugging Face

TinyLlama-1.1B-v1.1

We adopted exactly the same architecture and tokenizer as Llama 2. This means TinyLlama can be plugged and played in many open-source projects built upon Llama. Besides, TinyLlama is compact with only 1.1B parameters. This compactness allows it to cater to a multitude of applications demanding a restricted computation and memory footprint.

Overview

In this project, rather than only training a single TinyLlama model, we first train TinyLlama on a corpus of 1.5 trillion tokens to obtain foundational language capabilities. Subsequently, we take this model and turn it into three different models by continual pre-training with three distinct data sampling. For a visual representation of this process, please refer to the figure below.

Overview

Pretraining

Due to these issues(bug1, bug2). We try to retrain our TinyLlama to provide a better model. We train our model with 2T tokens and divided our pretraining into 3 different stages: 1) basic pretraining, 2) continual pretraining with specific domain, and 3) cooldown .

Basic pretraining

In this initial phase, we managed to train our model with only slimpajama to develop its commonsense reasoning capabilities. The model was trained with 1.5T tokens during this basic pretraining period. Since we used a cluster with 4 A100-40G per node and we only shard model weights within a node, we can only set the batch size to approximately 1.8M this time.

Continual pretraining with specific domain

We incorporated 3 different kinds of corpus during this pretraining, slimpajama (which is the same as the first phase), Math&Code (starcoder and proof pile), and Chinese (Skypile). This approach allowed us to develop three variant models with specialized capabilities.

At the begining ~6B tokens in this stage, we linearly increased the sampling proportion for the domain-specific corpus (excluding Slimpajama, as it remained unchanged compared with stage 1). This warmup sampling increasing strategy was designed to gradually adjust the distribution of the pretraining data, ensuring a more stable training process. After this sampling increasing stage, we continued pretraining the model with stable sampling strategy until reaching ~1.85T tokens.

Cooldown

Implementing a cooldown phase has become a crucial technique to achieve better model convergence at the end of pretraining. However, since we have already used cosine learning rate strategy at the beginning, it becomes challenging to alter the learning rate for cooldown like what MiniCPM or deepseek does. Therefore, we try to cool down with adjusting our batch size. Specifically, we increase our batch size from 1.8M to 7.2M while keeping the original cosine learning rate schedule during our cooldown stage.

Tinyllama model family

Following an extensive and detailed pretraining process. We are now releasing three specialized versions of our model:

  1. TinyLlama_v1.1: The standard version, used for general purposes.
  2. TinyLlama_v1.1_Math&Code: Equipped with better ability for math and code.
  3. TinyLlama_v1.1_Chinese: Good understanding capacity for Chinese.

Data

Here we list our data distribution in each stage:

TinyLlama_v1.1

CorpusBasic pretrainingContinual pretraining with specific domainCooldown
Slimpajama100.0100.0100.0

TinyLlama_v1.1_math_code

CorpusBasic pretrainingContinual pretraining with specific domainCooldown
Slimpajama100.075.075.0
starcoder-15.015.0
proof_pile-10.010.0

TinyLlama_v1.1_chinese

orpusBasic pretrainingContinual pretraining with specific domainCooldown
Slimpajama100.050.050.0
skypile-50.050.0

How to use

You will need the transformers>=4.31 Do check the TinyLlama GitHub page for more information.

from transformers import AutoTokenizer
import transformers 
import torch
model = "TinyLlama/TinyLlama_v1.1"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
    "text-generation",
    model=model,
    torch_dtype=torch.float16,
    device_map="auto",
)

sequences = pipeline(
    'The TinyLlama project aims to pretrain a 1.1B Llama model on 3 trillion tokens. With some proper optimization, we can achieve this within a span of "just" 90 days using 16 A100-40G GPUs 🚀🚀. The training has started on 2023-09-01.',
    do_sample=True,
    top_k=10,
    num_return_sequences=1,
    repetition_penalty=1.5,
    eos_token_id=tokenizer.eos_token_id,
    max_length=500,
)
for seq in sequences:
    print(f"Result: {seq['generated_text']}")

Eval

ModelPretrain TokensHellaSwagObqaWinoGrandeARC_cARC_eboolqpiqaavg
Pythia-1.0B300B47.1631.4053.4327.0548.9960.8369.2148.30
TinyLlama-1.1B-intermediate-step-1431k-3T3T59.2036.0059.1230.1255.2557.8373.2952.99
TinyLlama-1.1B-v1.12T61.4736.8059.4332.6855.4755.9973.5653.63
TinyLlama-1.1B-v1_math_code2T60.8036.4060.2233.8755.2057.0972.6953.75
TinyLlama-1.1B-v1.1_chinese2T58.2335.2059.2731.4055.3561.4173.0153.41

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

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

GPU в ailist

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

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

Подбираем GPU…

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

0 моделей