/ Модель

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

Контекст
512 токенов
Параметры
124 млн
Лицензия
Apache 2.0
Архитектура
switch_transformers · MoE
Опубликована
24 окт 2022

switch-base-8

Языковая модель3 профессии

Англоязычная модель Google с архитектурой Switch Transformers и разреженным Mixture of Experts, предварительно обученная для последующей настройки на задачи преобразования текста.

8 489скачиваний за 30 дней20лайковвеса обновлены24 янв 2023

Бенчмарки

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

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

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

  • MUSR

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

    Результат

    0,3517

    Open LLM v2 · архив

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

  • BBH

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

    Результат

    0,2876

    Open LLM v2 · архив

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

  • GPQA

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

    Результат

    0,25

    Open LLM v2 · архив

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

  • IFEval

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

    Результат

    0,1585

    Open LLM v2 · архив

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

  • MATH Lvl 5

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

    Результат

    0

    Open LLM v2 · архив

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

  • MMLU-PRO

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

    Результат

    0,1098

    Open LLM v2 · архив

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

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

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

Switch-base-8 — англоязычная модель Google семейства Switch Transformers, построенная на архитектуре T5 с разреженными слоями Mixture of Experts: в них полносвязные слои заменены набором экспертных MLP. Модель содержит 123,8 млн параметров и распространяется в формате PyTorch по лицензии Apache 2.0.

Чекпойнт предварительно обучен на задаче masked language modeling на корпусе C4. Он предназначен для дальнейшей настройки и исследований задач преобразования текста; карточка предупреждает, что веса не готовы к прямому применению в прикладных задачах. В README отмечены масштабируемость и ускорение обучения архитектуры Switch Transformers, но конкретные показатели этого чекпойнта не приведены.

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

  • дообучение модели для генерации текста по текстовому запросу
  • эксперименты с архитектурой Mixture of Experts
  • исследование переноса обучения с корпуса C4
  • создание специализированной модели преобразования текста

Ограничения

Чекпойнт обучен на задаче masked language modeling и, согласно карточке, не готов к непосредственному использованию в прикладных задачах — для этого требуется дообучение. Карточка не приводит подробностей об известных ограничениях и количественных результатах именно этой версии.

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

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

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

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

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

Открыть на Hugging Face

Model Card for Switch Transformers Base - 8 experts

model image

Table of Contents

  1. TL;DR
  2. Model Details
  3. Usage
  4. Uses
  5. Bias, Risks, and Limitations
  6. Training Details
  7. Evaluation
  8. Environmental Impact
  9. Citation
  10. Model Card Authors

TL;DR

Switch Transformers is a Mixture of Experts (MoE) model trained on Masked Language Modeling (MLM) task. The model architecture is similar to the classic T5, but with the Feed Forward layers replaced by the Sparse MLP layers containing "experts" MLP. According to the original paper the model enables faster training (scaling properties) while being better than T5 on fine-tuned tasks. As mentioned in the first few lines of the abstract :

we advance the current scale of language models by pre-training up to trillion parameter models on the “Colossal Clean Crawled Corpus”, and achieve a 4x speedup over the T5-XXL model.

Disclaimer: Content from this model card has been written by the Hugging Face team, and parts of it were copy pasted from the original paper.

Model Details

Model Description

Usage

Note that these checkpoints has been trained on Masked-Language Modeling (MLM) task. Therefore the checkpoints are not "ready-to-use" for downstream tasks. You may want to check FLAN-T5 for running fine-tuned weights or fine-tune your own MoE following this notebook

Find below some example scripts on how to use the model in transformers:

Using the Pytorch model

Running the model on a CPU


from transformers import AutoTokenizer, SwitchTransformersForConditionalGeneration

tokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")
model = SwitchTransformersForConditionalGeneration.from_pretrained("google/switch-base-8")

input_text = "A <extra_id_0> walks into a bar a orders a <extra_id_1> with <extra_id_2> pinch of <extra_id_3>."
input_ids = tokenizer(input_text, return_tensors="pt").input_ids

outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))
>>> <pad> <extra_id_0> man<extra_id_1> beer<extra_id_2> a<extra_id_3> salt<extra_id_4>.</s>

Running the model on a GPU

# pip install accelerate
from transformers import AutoTokenizer, SwitchTransformersForConditionalGeneration

tokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")
model = SwitchTransformersForConditionalGeneration.from_pretrained("google/switch-base-8", device_map="auto")

input_text = "A <extra_id_0> walks into a bar a orders a <extra_id_1> with <extra_id_2> pinch of <extra_id_3>."
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)

outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))
>>> <pad> <extra_id_0> man<extra_id_1> beer<extra_id_2> a<extra_id_3> salt<extra_id_4>.</s>

Running the model on a GPU using different precisions

FP16

# pip install accelerate
from transformers import AutoTokenizer, SwitchTransformersForConditionalGeneration

tokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")
model = SwitchTransformersForConditionalGeneration.from_pretrained("google/switch-base-8", device_map="auto", torch_dtype=torch.float16)

input_text = "A <extra_id_0> walks into a bar a orders a <extra_id_1> with <extra_id_2> pinch of <extra_id_3>."
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)

outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))
>>> <pad> <extra_id_0> man<extra_id_1> beer<extra_id_2> a<extra_id_3> salt<extra_id_4>.</s>

INT8

# pip install bitsandbytes accelerate
from transformers import AutoTokenizer, SwitchTransformersForConditionalGeneration

tokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")
model = SwitchTransformersForConditionalGeneration.from_pretrained("google/switch-base-8", device_map="auto")

input_text = "A <extra_id_0> walks into a bar a orders a <extra_id_1> with <extra_id_2> pinch of <extra_id_3>."
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)

outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))
>>> <pad> <extra_id_0> man<extra_id_1> beer<extra_id_2> a<extra_id_3> salt<extra_id_4>.</s>

Uses

Direct Use and Downstream Use

See the research paper for further details.

Out-of-Scope Use

More information needed.

Bias, Risks, and Limitations

More information needed.

Ethical considerations and risks

More information needed.

Known Limitations

More information needed.

Sensitive Use:

More information needed.

Training Details

Training Data

The model was trained on a Masked Language Modeling task, on Colossal Clean Crawled Corpus (C4) dataset, following the same procedure as T5.

Training Procedure

According to the model card from the original paper the model has been trained on TPU v3 or TPU v4 pods, using t5x codebase together with jax.

Evaluation

Testing Data, Factors & Metrics

The authors evaluated the model on various tasks and compared the results against T5. See the table below for some quantitative evaluation: image.png For full details, please check the research paper.

Results

For full results for Switch Transformers, see the research paper, Table 5.

Environmental Impact

Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).

  • Hardware Type: Google Cloud TPU Pods - TPU v3 or TPU v4 | Number of chips ≥ 4.
  • Hours used: More information needed
  • Cloud Provider: GCP
  • Compute Region: More information needed
  • Carbon Emitted: More information needed

Citation

BibTeX:

@misc{https://doi.org/10.48550/arxiv.2101.03961,
  doi = {10.48550/ARXIV.2101.03961},
  
  url = {https://arxiv.org/abs/2101.03961},
  
  author = {Fedus, William and Zoph, Barret and Shazeer, Noam},
  
  keywords = {Machine Learning (cs.LG), Artificial Intelligence (cs.AI), FOS: Computer and information sciences, FOS: Computer and information sciences},
  
  title = {Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity},
  
  publisher = {arXiv},
  
  year = {2021},
  
  copyright = {arXiv.org perpetual, non-exclusive license}
}

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

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

GPU в ailist

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

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

У модели не указана задача.

Класс архитектуры
SwitchTransformersForConditionalGeneration
Ревизия весов
92fe2d2

0 моделей