← Open Source
ai-forever

ru-gpts

Russian GPT3 models.

ModelsLanguage-specific modelsPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
2.09k
Stars
433
Forks
+-1
This week
3
Contributors
Created 2020-10-13 · Updated 2026-10-13 · #9003 today
Top developers
king-meninTatianaShavrinaollmer

ai-forever/ru-gpts is ranked 9,003 with 2,089 stars.

Same-category comparison

ai-forever/ru-gpts is ranked 9,003 among these 8 peers; bytedance/Protenix is ranked 9,012.

Same-category comparison
NameRankMetrics
AIZOOTech/FaceMaskDetection8,957
Language:
Jupyter Notebook
Stars:
2,120
Forks:
614
QwenLM/Qwen2-Audio8,977
Language:
Python
Stars:
2,106
Forks:
173
Description:
The official repo of Qwen2-Audio chat & pretrained large audio language model proposed by Alibaba Cloud.
SUDO-AI-3D/zero123plus8,983
Language:
Python
Stars:
2,102
Forks:
149
Description:
Code repository for Zero123++: a Single Image to Consistent Multi-view Diffusion Base Model.
facebookresearch/chameleon8,984
Language:
Python
Stars:
2,101
Forks:
117
Description:
Repository for Meta Chameleon, a mixed-modal early-fusion foundation model from FAIR.
bytedance/Protenix9,012
Language:
Python
Stars:
2,080
Forks:
328
Description:
Toward High-Accuracy Open-Source Biomolecular Structure Prediction.
facebookresearch/ConvNeXt-V29,030
Language:
Python
Stars:
2,065
Forks:
177
Description:
Code release for ConvNeXt V2 model.
cfzd/Ultra-Fast-Lane-Detection9,037
Language:
Python
Stars:
2,063
Forks:
524
Description:
Ultra Fast Structure-aware Deep Lane Detection (ECCV 2020).
serengil/retinaface9,041
Language:
Python
Stars:
2,060
Forks:
201
Description:
RetinaFace: Deep Face Detection Library for Python.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModels
SubcategoryLanguage-specific models
Stars2,089
Forks433
Contributors3
Created date2020-10-13
Updated date2026-10-13
Stars in 1 day0
Stars in 7 days-1
Rank9,003
Previous rank9,052
Rank change49
7-day stars rank16,959
Previous 7-day stars rank12,211
7-day stars rank change-4,748
Total stars rank6,130
Previous total stars rank6,124
Total stars rank change-6
CountryArmenia
README summary

Russian GPT-3 models ruGPT3XL, ruGPT3Large, ruGPT3Medium, ruGPT3Small and ruGPT2Large This repository contains bunch of autoregressive transformer language models trained on a huge dataset of russian language. Russian GPT-3 models (ruGPT3XL, ruGPT3Large, ruGPT3Medium, ruGPT3Small) trained with 2048 sequence length with sparse and dense attention blocks. We also provide Russian GPT-2 large model (ruGPT2Large) trained with 1024 sequence length. Table of contents ruGPT3XL Setup Usage Finetune Pretraining details ruGPT3XL ruGPT3Large, ruGPT3Medium, ruGPT3Small, ruGPT2Large Setup Usage Pretraining details Papers mentioning

ruGPT3 OpenSource Solutions with ruGPT3 ruGPT3XL Setup For colab we recommend use the following installation instructions: After installation env please restart colab. For checking is all ok, run the following commands: Usage Finetuning Example of finetune, load finetuned model and generate is here. Our example of finetuning script here Pretraining details ruGPT3XL Model was trained with 512 sequence length using Deepspeed and Megatron code by Devices team, on 80B tokens dataset for 4 epochs. After that model was finetuned 1

epoch with sequence length 2048. * Total training time was around 10 days on 256 GPUs. ruGPT3Large, ruGPT3Medium, ruGPT3Small, ruGPT2Large Setup For using ruGPT3Large, ruGPT3Medium, ruGPT3Small, ruGPT2Large just install 🤗HuggingFace transformers. Usage Here we can obtain examples of finetuning or generation. Also this examples is adapted for google colab: Pretraining details All pretraining was done on Nvidia Tesla V100-SXM3 32 Gb GPUs on a Christofari Cluster. Following are the details of pretraining for each model. Pretraining details ruGPT3Large Model was

trained with sequence length 1024 using transformers lib by Devices team on 80B tokens for 3 epochs. After that model was finetuned 1 epoch with sequence length 2048. Total training time was around 14 days on 128 GPUs for 1024 context and few days on 16 GPUs for 2048 context. You can obtain this model by using transformers with model name . 🤗HuggingFace model card link Our pretraining script here Pretraining details ruGPT3Medium Model was trained with sequence length 1024 using

transformers lib by Devices team on 80B tokens for 3 epoch. After that model was finetuned on 2048 context. Total training time was around 16 days on 64 GPUs. You can obtain this model by using transformers with model name . 🤗HuggingFace model card link Our pretraining script here Pretraining details ruGPT3Small Model was trained with sequence length 1024 using transformers by Devices team on 80B tokens around 3 epoch. After that model was finetuned on 2048 context. Total training time

took around one week on 32 GPUs. You can obtain this model by using transformers with model name . 🤗HuggingFace model card link Our pretraining script here Pretraining details ruGPT2Large Model was trained with sequence length 1024 using transformers by Devices team on 170Gb data on 64 GPUs 3 weeks. You can obtain this model by using transformers with model name . 🤗HuggingFace model card link OpenSource Solutions with ruGPT3 ruCLIP Github Simplification with ruGPT-3 XL Github Word normalization (RuNormAS shared

task) Github AI CopyWriter Github ЕГЭ Generation Github NeuroZhirinovsky Github PseudoKant Github DostoevskyDoesntWriteIt Github Papers mentioning ruGPT3 According to google scholar

Frequently asked questions

How many stars and forks are recorded?

ai-forever/ru-gpts has 2,089 stars and 433 forks.

What is the repository rank?

ai-forever/ru-gpts is ranked 9,003.

What language and category are recorded?

ai-forever/ru-gpts has 2,089 stars, uses Python and belongs to Models.

Which repository is closest in rank?

ai-forever/ru-gpts is compared with bytedance/Protenix, ranked 9,012 with 2,080 stars.

README

Russian GPT-3 models

ruGPT3XL, ruGPT3Large, ruGPT3Medium, ruGPT3Small and ruGPT2Large

This repository contains bunch of autoregressive transformer language models trained on a huge dataset of russian language.

  • Russian GPT-3 models (ruGPT3XL, ruGPT3Large, ruGPT3Medium, ruGPT3Small) trained with 2048 sequence length with sparse and dense attention blocks. We also provide Russian GPT-2 large model (ruGPT2Large) trained with 1024 sequence length.

  • Try Model Generation In Colab! ruGPT-3 XL: or ruGPT-3 smaller models:

  • Usage examples are described in detail here. See how fine-tuning works:

Table of contents

ruGPT3XL

Setup

For colab we recommend use the following installation instructions:

export LD_LIBRARY_PATH=/usr/lib/
apt-get install clang-9 llvm-9 llvm-9-dev llvm-9-tools
git clone https://github.com/qywu/apex
cd apex
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
pip install triton
DS_BUILD_CPU_ADAM=1 DS_BUILD_SPARSE_ATTN=1 pip install deepspeed
pip install transformers
pip install huggingface_hub
pip install timm==0.3.2
git clone  https://github.com/sberbank-ai/ru-gpts
cp ru-gpts/src_utils/trainer_pt_utils.py /usr/local/lib/python3.8/dist-packages/transformers/trainer_pt_utils.py
cp ru-gpts/src_utils/_amp_state.py /usr/local/lib/python3.8/dist-packages/apex/amp/_amp_state.py

After installation env please restart colab. For checking is all ok, run the following commands:

!ds_report
# Output:
...
sparse_attn ............ [YES] ...... [OKAY]
...
import deepspeed.ops.sparse_attention.sparse_attn_op

Usage

Here is a simple example of usage. For more see this example or .

import sys
from src.xl_wrapper import RuGPT3XL
import os

# If run to from content root.
sys.path.append("ru-gpts/")
os.environ["USE_DEEPSPEED"] = "1"
# We can change address and port
os.environ["MASTER_ADDR"] = "127.0.0.1"
os.environ["MASTER_PORT"] = "5000"
gpt = RuGPT3XL.from_pretrained("sberbank-ai/rugpt3xl", seq_len=512)
gpt.generate(
    "Кто был президентом США в 2020? ",
    max_length=50,
    no_repeat_ngram_size=3,
    repetition_penalty=2.,
)

Finetuning

Example of finetune, load finetuned model and generate is here.

Our example of finetuning script here

Pretraining details ruGPT3XL

Model was trained with 512 sequence length using Deepspeed and Megatron code by Devices team, on 80B tokens dataset for 4 epochs. After that model was finetuned 1 epoch with sequence length 2048.
Note! Model has sparse attention blocks.

Total training time was around 10 days on 256 GPUs.
Final perplexity on test set is 12.05.

🤗HuggingFace model card link.

ruGPT3Large, ruGPT3Medium, ruGPT3Small, ruGPT2Large

Setup

For using ruGPT3Large, ruGPT3Medium, ruGPT3Small, ruGPT2Large just install 🤗HuggingFace transformers.

pip install transformers==4.24.0

Usage

Here we can obtain examples of finetuning or generation.

Also this examples is adapted for google colab:

  • finetuning: .
  • generation:
from transformers import GPT2LMHeadModel, GPT2Tokenizer


model_name_or_path = "sberbank-ai/rugpt3large_based_on_gpt2"
tokenizer = GPT2Tokenizer.from_pretrained(model_name_or_path)
model = GPT2LMHeadModel.from_pretrained(model_name_or_path).cuda()
text = "Александр Сергеевич Пушкин родился в "
input_ids = tokenizer.encode(text, return_tensors="pt").cuda()
out = model.generate(input_ids.cuda())
generated_text = list(map(tokenizer.decode, out))[0]
print(generated_text)
# Output should be like this:
# Александр Сергеевич Пушкин родился в \n1799 году. Его отец был крепостным крестьянином, а мать – крепостной крестьянкой. Детство и юность Пушкина прошли в деревне Михайловское под Петербургом. В 1820-х годах семья переехала

Pretraining details

All pretraining was done on Nvidia Tesla V100-SXM3 32 Gb GPUs on a Christofari Cluster. Following are the details of pretraining for each model.

Pretraining details ruGPT3Large

Model was trained with sequence length 1024 using transformers lib by Devices team on 80B tokens for 3 epochs. After that model was finetuned 1 epoch with sequence length 2048.

Total training time was around 14 days on 128 GPUs for 1024 context and few days on 16 GPUs for 2048 context.
Final perplexity on test set is 13.6.

You can obtain this model by using transformers with model name sberbank-ai/rugpt3large_based_on_gpt2.

🤗HuggingFace model card link

Our pretraining script here

Pretraining details ruGPT3Medium

Model was trained with sequence length 1024 using transformers lib by Devices team on 80B tokens for 3 epoch. After that model was finetuned on 2048 context.

Total training time was around 16 days on 64 GPUs.
Final perplexity on test set is 17.4.

You can obtain this model by using transformers with model name sberbank-ai/rugpt3medium_based_on_gpt2.

🤗HuggingFace model card link

Our pretraining script here

Pretraining details ruGPT3Small

Model was trained with sequence length 1024 using transformers by Devices team on 80B tokens around 3 epoch. After that model was finetuned on 2048 context.

Total training time took around one week on 32 GPUs.

You can obtain this model by using transformers with model name sberbank-ai/rugpt3small_based_on_gpt2.

🤗HuggingFace model card link

Our pretraining script here

Pretraining details ruGPT2Large

Model was trained with sequence length 1024 using transformers by Devices team on 170Gb data on 64 GPUs 3 weeks.

You can obtain this model by using transformers with model name sberbank-ai/rugpt2large.

🤗HuggingFace model card link

OpenSource Solutions with ruGPT3

Papers mentioning ruGPT3

According to google scholar search - feel free to add links to this list

Text Simplification

@article{shatilovsentence,
  title={Sentence simplification with ruGPT3},
  author={Shatilov, AA and Rey, AI},
  url={http://www.dialog-21.ru/media/5281/shatilovaaplusreyai142.pdf}
}

@article{fenogenovatext,
  title={Text Simplification with Autoregressive Models},
  author={Fenogenova, Alena},
  url={http://www.dialog-21.ru/media/5250/fenogenovaa141.pdf}}

Text Detoxification

@article{dementieva2021methods,
  title={Methods for Detoxification of Texts for the Russian Language},
  author={Dementieva, Daryna and Moskovskiy, Daniil and Logacheva, Varvara and Dale, David and Kozlova, Olga and Semenov, Nikita and Panchenko, Alexander},
  journal={arXiv preprint arXiv:2105.09052},
  year={2021},
  url={https://arxiv.org/abs/2105.09052}
}

Paraphrasing and Data Augmentation

@inproceedings{fenogenova2021russian,
  title={Russian Paraphrasers: Paraphrase with Transformers},
  author={Fenogenova, Alena},
  booktitle={Proceedings of the 8th Workshop on Balto-Slavic Natural Language Processing},
  pages={11--19},
  year={2021},
  url={https://www.aclweb.org/anthology/2021.bsnlp-1.2.pdf}
}

Model Evaluation

@article{malykh2021morocco,
  title={MOROCCO: Model Resource Comparison Framework},
  author={Malykh, Valentin and Kukushkin, Alexander and Artemova, Ekaterina and Mikhailov, Vladislav and Tikhonova, Maria and Shavrina, Tatiana},
  journal={arXiv preprint arXiv:2104.14314},
  year={2021},
  url={https://arxiv.org/abs/2104.14314}}
Nearby in the ranking
Similar items