/ Модель

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

Контекст
4 096 токенов
Параметры
296 млн
Лицензия
Apache 2.0
Архитектура
longt5 · dense
Опубликована
19 мая 2023

mlong-t5-tglobal-base

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

Многоязычный энкодер-декодер MLongT5 для дообучаемой генерации текста по длинным входам, например суммаризации и ответов на вопросы.

581скачиваний за 30 дней10лайковвеса обновлены21 мая 2023

Бенчмарки

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

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

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

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

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

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

agemagician/mlong-t5-tglobal-base — предварительно обученная многоязычная модель Google Research, опубликованная Ahmed Elnaggar на Hugging Face. Это базовая модель семейства MLongT5: энкодер-декодер Transformer с механизмом transient-global attention, обученный преобразовывать текст в текст с помощью denoising-предобучения. Веса доступны в форматах PyTorch и Flax; размер модели — 296 млн параметров, нативный контекст по метаданным — 4096 токенов.

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

Лицензия — Apache-2.0. Это базовый чекпойнт для дальнейшей настройки: качество на прикладной задаче зависит от дообучения, а готовое качество для конкретной задачи в карточке не заявлено.

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

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

Ограничения

Это базовая модель, предназначенная преимущественно для дообучения; готовое качество на конкретных задачах не подтверждено. В метаданных указан контекст 4096 токенов, тогда как README заявляет обработку последовательностей до 16 384 токенов.

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

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

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

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

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

Открыть на Hugging Face

MLongT5 (transient-global attention, base-sized model)

MLongT5 model pre-trained on Multi-language corpus. The model was introduced in the paper mLongT5: A Multilingual and Efficient Text-To-Text Transformer for Longer Sequences by Uthus et al. and first released in the LongT5 repository. All the model architecture and configuration can be found in Flaxformer repository which uses another Google research project repository T5x.

Disclaimer: The team releasing MLongT5 did not write a model card for this model so this model card has been written by Ahmed Elnaggar.

Model description

MLongT5 model is an encoder-decoder transformer pre-trained in a text-to-text denoising generative setting (Pegasus-like generation pre-training). MLongT5 model is an extension of LongT5 model, and it enables using one of the two different efficient attention mechanisms - (1) Local attention, or (2) Transient-Global attention. The usage of attention sparsity patterns allows the model to efficiently handle input sequence.

MLongT5 is particularly effective when fine-tuned for text generation (summarization, question answering) which requires handling long input sequences (up to 16,384 tokens).

Intended uses & limitations

The model is mostly meant to be fine-tuned on a supervised dataset. See the model hub to look for fine-tuned versions on a task that interests you.

How to use

How to use

The following shows how one can extract the last hidden representation for the model.

from transformers import T5Tokenizer, LongT5Model

tokenizer = T5Tokenizer.from_pretrained("agemagician/mlong-t5-tglobal-base")
model = LongT5Model.from_pretrained("agemagician/mlong-t5-tglobal-base")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state

The following shows how one can predict masked passages using the different denoising strategies.

S-Denoising

For S-Denoising, please make sure to prompt the text with the prefix [S2S] as shown below.

from transformers import LongT5ForConditionalGeneration, T5Tokenizer
import torch

model = LongT5ForConditionalGeneration.from_pretrained("agemagician/mlong-t5-tglobal-base", low_cpu_mem_usage=True, torch_dtype=torch.bfloat16).to("cuda")                                                                                                   
tokenizer = T5Tokenizer.from_pretrained("agemagician/mlong-t5-tglobal-base")

input_string = "[S2S] Mr. Dursley was the director of a firm called Grunnings, which made drills. He was a big, solid man with a bald head. Mrs. Dursley was thin and blonde and more than the usual amount of neck, which came in very useful as she spent so much of her time craning over garden fences, spying on the neighbours. The Dursleys had a small son called Dudley and in their opinion there was no finer boy anywhere <extra_id_0>"                                               

inputs = tokenizer(input_string, return_tensors="pt").input_ids.to("cuda")

outputs = model.generate(inputs, max_length=200)

print(tokenizer.decode(outputs[0]))

R-Denoising

For R-Denoising, please make sure to prompt the text with the prefix [NLU] as shown below.

from transformers import LongT5ForConditionalGeneration, T5Tokenizer
import torch

model = LongT5ForConditionalGeneration.from_pretrained("agemagician/mlong-t5-tglobal-base", low_cpu_mem_usage=True, torch_dtype=torch.bfloat16).to("cuda")                                                                                                   
tokenizer = T5Tokenizer.from_pretrained("agemagician/mlong-t5-tglobal-base")

input_string = "[NLU] Mr. Dursley was the director of a firm called <extra_id_0>, which made <extra_id_1>. He was a big, solid man with a bald head. Mrs. Dursley was thin and <extra_id_2> of neck, which came in very useful as she spent so much of her time <extra_id_3>. The Dursleys had a small son called Dudley and <extra_id_4>"                                               

inputs = tokenizer(input_string, return_tensors="pt", add_special_tokens=False).input_ids.to("cuda")

outputs = model.generate(inputs, max_length=200)

print(tokenizer.decode(outputs[0]))

X-Denoising

For X-Denoising, please make sure to prompt the text with the prefix [NLG] as shown below.

from transformers import LongT5ForConditionalGeneration, T5Tokenizer
import torch

model = LongT5ForConditionalGeneration.from_pretrained("agemagician/mlong-t5-tglobal-base", low_cpu_mem_usage=True, torch_dtype=torch.bfloat16).to("cuda")                                                                                                   
tokenizer = T5Tokenizer.from_pretrained("agemagician/mlong-t5-tglobal-base")

input_string = "[NLG] Mr. Dursley was the director of a firm called Grunnings, which made drills. He was a big, solid man wiht a bald head. Mrs. Dursley was thin and blonde and more than the usual amount of neck, which came in very useful as she
spent so much of her time craning over garden fences, spying on the neighbours. The Dursleys had a small son called Dudley and in their opinion there was no finer boy anywhere. <extra_id_0>"                                               

model.cuda()
inputs = tokenizer(input_string, return_tensors="pt", add_special_tokens=False).input_ids.to("cuda")

outputs = model.generate(inputs, max_length=200)

print(tokenizer.decode(outputs[0]))

BibTeX entry and citation info

@misc{uthus2023mlongt5,
      title={mLongT5: A Multilingual and Efficient Text-To-Text Transformer for Longer Sequences}, 
      author={David Uthus and Santiago Ontañón and Joshua Ainslie and Mandy Guo},
      year={2023},
      eprint={2305.11129},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

Created by Ahmed Elnaggar/@Elnaggar_AI | LinkedIn

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

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

GPU в ailist

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

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

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

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

0 моделей