/ Модель

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

Контекст
514 токенов
Параметры
95,2 млн
Лицензия
CC BY 4.0
Архитектура
roberta · dense
Опубликована
2 мар 2022

tinyroberta-squad2

Ответы на вопросыТекст → текст8 профессий

Компактная англоязычная модель RoBERTa от deepset извлекает ответы на вопросы из текста и работает примерно вдвое быстрее базовой версии.

193 тыс.скачиваний за 30 дней114лайковвеса обновлены26 сен 2024

Бенчмарки

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

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

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

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

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

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

deepset/tinyroberta-squad2 — компактная модель deepset для извлечения ответов на вопросы из текста. Это дистиллированная версия deepset/roberta-base-squad2 на архитектуре RoBERTa с 95,2 млн параметров; контекст составляет до 514 токенов. Модель обучена для extractive question answering на SQuAD 2.0 и рассчитана на английский язык.

Модель находит ответный фрагмент в предоставленном тексте и подходит для поиска ответов в документах, например в конвейере Haystack. По данным карточки, её качество сопоставимо с базовой моделью, а скорость работы примерно вдвое выше. Дистилляция выполнена в два этапа по подходу TinyBERT: промежуточная дистилляция RoBERTa, затем обучение под задачу QA с учителями deepset/roberta-base-squad2 и deepset/roberta-large-squad2.

Доступны веса PyTorch и Safetensors. Лицензия — CC BY 4.0. Модель предназначена для извлечения ответа из заданного контекста, а не для свободной генерации; качество и охват языков за пределами английского не подтверждены карточкой.

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

  • поиск ответного фрагмента в англоязычном документе
  • ответы на вопросы по внутренним текстовым материалам
  • извлечение фактов из статей и справочных текстов
  • построение конвейера extractive QA в Haystack

Ограничения

Модель рассчитана на английский язык и извлечение ответов из предоставленного контекста; для свободной генерации она не предназначена. Контекст ограничен 514 токенами.

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

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

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

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

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

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

Открыть на Hugging Face

tinyroberta for Extractive QA

This is the distilled version of the deepset/roberta-base-squad2 model. This model has a comparable prediction quality and runs at twice the speed of the base model.

Overview

Language model: tinyroberta-squad2
Language: English
Downstream-task: Extractive QA
Training data: SQuAD 2.0
Eval data: SQuAD 2.0
Code: See an example extractive QA pipeline built with Haystack
Infrastructure: 4x Tesla v100

Hyperparameters

batch_size = 96
n_epochs = 4
base_LM_model = "deepset/tinyroberta-squad2-step1"
max_seq_len = 384
learning_rate = 3e-5
lr_schedule = LinearWarmup
warmup_proportion = 0.2
doc_stride = 128
max_query_length = 64
distillation_loss_weight = 0.75
temperature = 1.5
teacher = "deepset/robert-large-squad2"

Distillation

This model was distilled using the TinyBERT approach described in this paper and implemented in haystack. Firstly, we have performed intermediate layer distillation with roberta-base as the teacher which resulted in deepset/tinyroberta-6l-768d. Secondly, we have performed task-specific distillation with deepset/roberta-base-squad2 as the teacher for further intermediate layer distillation on an augmented version of SQuADv2 and then with deepset/roberta-large-squad2 as the teacher for prediction layer distillation.

Usage

In Haystack

Haystack is an AI orchestration framework to build customizable, production-ready LLM applications. You can use this model in Haystack to do extractive question answering on documents. To load and run the model with Haystack:

# After running pip install haystack-ai "transformers[torch,sentencepiece]"

from haystack import Document
from haystack.components.readers import ExtractiveReader

docs = [
    Document(content="Python is a popular programming language"),
    Document(content="python ist eine beliebte Programmiersprache"),
]

reader = ExtractiveReader(model="deepset/tinyroberta-squad2")
reader.warm_up()

question = "What is a popular programming language?"
result = reader.run(query=question, documents=docs)
# {'answers': [ExtractedAnswer(query='What is a popular programming language?', score=0.5740374326705933, data='python', document=Document(id=..., content: '...'), context=None, document_offset=ExtractedAnswer.Span(start=0, end=6),...)]}

For a complete example with an extractive question answering pipeline that scales over many documents, check out the corresponding Haystack tutorial.

In Transformers

from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline

model_name = "deepset/tinyroberta-squad2"

# a) Get predictions
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
QA_input = {
    'question': 'Why is model conversion important?',
    'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
}
res = nlp(QA_input)

# b) Load model & tokenizer
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)

Performance

Evaluated on the SQuAD 2.0 dev set with the official eval script.

"exact": 78.69114798281817,
"f1": 81.9198998536977,

"total": 11873,
"HasAns_exact": 76.19770580296895,
"HasAns_f1": 82.66446878592329,
"HasAns_total": 5928,
"NoAns_exact": 81.17746005046257,
"NoAns_f1": 81.17746005046257,
"NoAns_total": 5945

Authors

Branden Chan: branden.chan@deepset.ai
Timo Möller: timo.moeller@deepset.ai
Malte Pietsch: malte.pietsch@deepset.ai
Tanay Soni: tanay.soni@deepset.ai
Michel Bartels: michel.bartels@deepset.ai

About us

deepset is the company behind the production-ready open-source AI framework Haystack.

Some of our other work:

Get in touch and join the Haystack community

We also have a Discord community open to everyone!

Twitter | LinkedIn | Discord | GitHub Discussions | Website | YouTube

By the way: we're hiring!

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

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

GPU в ailist

Универсальный рантайм · question-answering

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

Подбираем GPU…

Класс архитектуры
RobertaForQuestionAnswering
Ревизия весов
12b287c

0 моделей