/ Модель

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

Контекст
4 096 токенов
Параметры
2,6 млрд
Лицензия
Apache 2.0
Архитектура
zamba2 · dense
Библиотека
transformers_zamba2
Опубликована
16 авг 2024

Zamba2-1.2B

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

Базовая гибридная языковая модель Zyphra с 2,6 млрд параметров для генерации текста и кода.

4 592скачиваний за 30 дней77лайковвеса обновлены7 фев 2025

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Zamba2-1.2B — базовая языковая модель Zyphra для генерации текста. Она сочетает слои Mamba2 с общим трансформерным блоком внимания; LoRA-проекции помогают этому блоку специализироваться на разных участках сети, а Rotary Position Embeddings улучшают работу с позиционной информацией. Модель содержит 2,6 млрд параметров и использует токенизатор Mistral v0.1.

Модель предварительно обучена на 3 трлн токенов текстовых и программных данных из открытых веб-источников, а затем дополнительно обучена на смеси из 100 млрд высококачественных токенов. Её можно применять для продолжения текста и кода. Контекст составляет 4096 токенов. Это базовая модель, не настроенная на выполнение инструкций или диалог; она не имеет встроенной модерации и может генерировать токсичный или иной вредоносный текст. Для эффективного запуска нужны совместимые версии Transformers и оптимизированные ядра Mamba2. Лицензия — Apache-2.0.

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

  • продолжение и дополнение текста
  • генерация фрагментов программного кода
  • эксперименты с гибридными архитектурами Mamba2 и Transformer
  • исследование базовой генерации без настройки на инструкции

Ограничения

Модель не настроена на следование инструкциям или диалог и не имеет встроенной модерации, поэтому может выдавать токсичный или вредоносный текст. В README указана временная реализация для Hugging Face с возможными проблемами совместимости; без оптимизированных ядер Mamba2 запуск медленнее и требует больше памяти.

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

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

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

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

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

Открыть на Hugging Face

Model Card for Zamba2-1.2B

Zamba2-1.2B is a hybrid model composed of state-space (Mamba) and transformer blocks. It broadly follows the Zamba architecture which consists of a Mamba backbone alternating with shared transformer blocks (see diagram in Model Details). Zamba2-1.2B possesses three major improvements over Zamba1:

1.) Mamba1 blocks have been replaced with Mamba2 blocks.

2.) We apply a LoRA projector to each shared MLP and attention block, which allows the network to specialize at each invocation of the shared transformer layer across depth. LoRA enables us to add depth-specialization for only a minimal increase in total parameter count.

3.) We utilize rotary position embeddings in the shared attention layer.

Zamba2-1.2B differs from our 2.7B model in three ways:

1.) We have added rotary position embeddings

2.) A single shared transformer block (instead of two that we alternate between)

3.) Added LoRA projectors to attention blocks (instead of just a LoRA on the MLP block)

We found that while hybrid SSM-transformer models are perfectly capable of performing well without position embeddings, adding rotary embeddings to the shared attention block slightly improved performance. Secondly, we utilize a single attention block (instead of alternating between two independent transformer blocks) because this enables a higher flop count for the model at a given parameter budget and at smaller scales this becomes more important than the slightly faster latency.

Zamba2-1.2B uses the Mistral v0.1 tokenizer and was pre-trained on 3T tokens of text and code data sourced from open web-datasets, including Zyda. Subsequently, in a second phase, Zamba2-1.2B was annealed on a mixture of 100B high-quality tokens.

Note: this is a temporary HuggingFace implementation of Zamba2-1.2B. It may not yet be fully compatible with all frameworks and tools intended to interface with HuggingFace models.

A standalone Pytorch implementation of Zamba2-1.2B may be found here.

Quick start

Prerequisites

To download Zamba2-1.2B, install transformers from source:

  1. git clone https://github.com/huggingface/transformers.git
  2. cd transformers && pip install .

To install dependencies necessary to run Mamba2 kernels, install mamba-ssm from source (due to compatibility issues with PyTorch) as well as causal-conv1d:

  1. git clone https://github.com/state-spaces/mamba.git
  2. cd mamba && git checkout v2.1.0 && pip install .
  3. pip install causal-conv1d

You can run the model without using the optimized Mamba2 kernels, but it is not recommended as it will result in significantly higher latency and memory usage.

Inference

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

tokenizer = AutoTokenizer.from_pretrained("Zyphra/Zamba2-1.2B")
model = AutoModelForCausalLM.from_pretrained("Zyphra/Zamba2-1.2B", device_map="cuda", torch_dtype=torch.bfloat16)

input_text = "What factors contributed to the fall of the Roman Empire?"
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")

outputs = model.generate(**input_ids, max_new_tokens=100)
print(tokenizer.decode(outputs[0]))

Model Details

Zamba2-1.2B utilizes and extends our original Zamba hybrid SSM-attention architecture. The core Zamba architecture consists of a backbone of Mamba layers interleaved with one or more shared attention layers. This attention has shared weights to minimize the parameter cost of the model. We find that concatenating the original model embeddings to the input to this attention block improves performance, likely due to better maintenance of information across depth. The Zamba2 architecture also applies LoRA projection matrices to the shared transformer blocks to gain some additional expressivity in each block and allow each shared block to specialize slightly to its own unique position while keeping the additional parameter overhead small.

Performance

Zamba2-1.2B achieves leading and state-of-the-art performance among models of <2B parameters and is competitive with some models of significantly greater size. Moreover, due to its unique hybrid SSM architecture, Zamba2-1.2B achieves extremely low inference latency and rapid generation with a significantly smaller memory footprint than comparable transformer based models.

Zamba2-1.2B's high performance and small inference compute and memory footprint renders it an ideal generalist model for on-device applications.

Time to First Token (TTFT)Output Generation
image/pngimage/png

And memory overhead

Notice

Zamba2-1.2B is a pretrained base model and therefore does not have any moderation mechanism and may output toxic or otherwise harmful language. In addition, one should not expect good instruct or chat performance, as this model was not fine-tuned for instruction following or chat.

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
Zamba2ForCausalLM
Ревизия весов
6b05bf2

0 моделей