/ Модель

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

Контекст
1 024 токена
Лицензия
CC BY-SA 4.0
Архитектура
gpt2 · dense
Опубликована
22 мая 2022

gpt2-small-czech-cs

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

Экспериментальная дообученная GPT-2 small генерирует продолжения текста на чешском языке по текстовому запросу.

77скачиваний за 30 дней1лайквеса обновлены25 мая 2022

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

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

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

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

spital/gpt2-small-czech-cs — экспериментальная языковая модель для генерации текста на чешском языке, разработанная Йиржи Спиталским. Это дообученная на чешской Википедии модель GPT-2 small: автор использовал предварительно обученную англоязычную GPT-2 small и методы transfer learning и fine-tuning. Модель построена на архитектуре GPT-2 и принимает текстовый запрос, продолжая его последовательностью текста; максимальная длина контекста составляет 1024 токена.

Модель предназначена для экспериментов с генерацией чешского текста при ограниченных вычислительных ресурсах. Её обучали на дампе чешской Википедии объёмом около 1 ГБ. Модель может воспроизводить ошибки и предвзятость данных и не подходит для сценариев, где критична достоверность сгенерированной информации. Распространяется по лицензии CC BY-SA 4.0, допускающей коммерческое использование при соблюдении её условий.

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

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

Ограничения

Обучающие данные взяты из чешской Википедии и могут содержать предвзятость; модель может генерировать недостоверные сведения. Для чувствительных к предвзятости сценариев требуется предварительная оценка.

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

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

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

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

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

Открыть на Hugging Face

GPT2-small-czech-cs: a Language Model for Czech text generation (and more NLP tasks ...)

Introduction

GPT2-small-czech-cs is a first experimental model for Czech language based on the GPT-2 small model.

It was trained on Czech Wikipedia using Transfer Learning and Fine-tuning techniques in about over a weekend on one GPU NVIDIA GTX 1080ti and with about 1GB of training data (cswiki). A training server with couple GPUs for experiments and one RTX 3080 ti was generously provided by ONYX engineering, spol. s r.o..

This experiment is a proof-of-concept that it is possible to get a state-of-the-art language model in any language with low resources.

It was fine-tuned from the English pre-trained GPT-2 small using the Hugging Face libraries (Transformers and Tokenizers) wrapped into the fastai2 Deep Learning framework. All the fine-tuning fastai v2 techniques were used. This work was inspired by Faster than training from scratch — Fine-tuning the English GPT-2 in any language with Hugging Face and fastai v2 (practical case with Portuguese), citation below.

It is now available on Hugging Face under gpt2-small-czech-cs. We release it under CC BY SA 4.0 license (i.e. allowing commercial use). For further information or requests, please post a Github issue at Github - gpt2-small-czech-cs.

Model description

Note: information copied/pasted from Model: gpt2 >> Model description

GPT-2 is a transformers model pretrained on a very large corpus of English data in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it was trained to guess the next word in sentences.

More precisely, inputs are sequences of continuous text of a certain length and the targets are the same sequence, shifted one token (word or piece of word) to the right. The model uses internally a mask-mechanism to make sure the predictions for the token i only uses the inputs from 1 to i but not the future tokens.

This way, the model learns an inner representation of the English language that can then be used to extract features useful for downstream tasks. The model is best at what it was pretrained for however, which is generating texts from a prompt.

How to use GPT2-small-czech-cs with HuggingFace (PyTorch)

Load the model and its sub-word tokenizer (Byte-level BPE)

from transformers import GPT2Tokenizer, GPT2LMHeadModel
pretrained = 'spital/gpt2-small-czech-cs'  # a local directory or huggingface model name
tokenizer = GPT2Tokenizer.from_pretrained(pretrained)
model = GPT2LMHeadModel.from_pretrained(pretrained, pad_token_id=tokenizer.eos_token_id)

# Sequence length max is 1024
tokenizer.model_max_length = 1024

# disable dropout (or leave in train mode to finetune)
model.eval()

Generate one word

import torch
# input sequence
text = "Umělá inteligence pomůže lidstvu překonat budoucí"
inp_tokens = tokenizer(text, return_tensors="pt")

# model output
outputs = model(**inp_tokens, labels=inp_tokens["input_ids"])
loss, logits = outputs[:2]
predicted_index = torch.argmax(logits[0, -1, :]).item()
predicted_text = tokenizer.decode([predicted_index])

# results
print('input text:', text)
print('predicted text:', predicted_text)
# predicted text:  problémy

Generate few full sequences

text = "Umělá inteligence pomůže lidstvu překonat budoucí"
encoded = tokenizer.encode(text, return_tensors='pt')
# torch.random.manual_seed(0)  # if you need reproducibility
sample_outputs = model.generate(encoded, do_sample=True,
             max_length=encoded.size()[1]+20,
             no_repeat_ngram_size=2, top_p=0.95, top_k=50,
             temperature=0.65, num_return_sequences=3)
for i, sample_output in enumerate(sample_outputs): print("{}: {}\n".format(i, tokenizer.decode(sample_output, skip_special_tokens=True)))

Limitations and bias

The training data used for this model come from Czech Wikipedia dump. We know it contains a lot of unfiltered content from the internet, which is far from neutral. As the openAI team themselves point out in their model card:

Because large-scale language models like GPT-2 do not distinguish fact from fiction, we don't support use-cases that require the generated text to be true. Additionally, language models like GPT-2 reflect the biases inherent to the systems they were trained on, so we do not recommend that they be deployed into systems that interact with humans > unless the deployers first carry out a study of biases relevant to the intended use-case. We found no statistically significant difference in gender, race, and religious bias probes between 774M and 1.5B, implying all versions of GPT-2 should be approached with similar levels of caution around use cases that are sensitive to biases around human attributes.

Author

Czech GPT-2 small was trained and evaluated by Jiri Spitalsky thanks to the computing power of the GPUs and other hardware generously provided by ONYX engineering, spol. s r.o..

Citation

My special thanks go to Pierre Guillou for his work GPorTuguese-2 (Portuguese GPT-2 small): a Language Model for Portuguese text generation (and more NLP tasks...), my work would not be possible without it.

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
GPT2LMHeadModel
Ревизия весов
8995bc6

0 моделей