Practical overview
When it fits
Use mGPT when an experiment requires a multilingual pretrained generative model and the repository’s language coverage or evaluation work is relevant. The README’s Transformers example is the clearest starting point for prompt-based generation.
Who it is for
- Researchers comparing language-model behaviour across multiple languages.
- Developers experimenting with multilingual text generation using Transformers.
- Teams studying cross-lingual NLU or probing world knowledge across languages.
Documented uses
- Generate a continuation from a text prompt using the model and tokenizer.
- Explore language modelling across the model’s listed languages.
- Evaluate cross-lingual NLU using the research benchmarks described by the project.
- Probe world knowledge across the languages covered by its evaluation.
Requirements & limits
The repository states that the source code and language models are available under the MIT license. It links to Hugging Face model cards and Colab notebooks for generation and fine-tuning examples.
- The README lists 61 pretrained languages, but does not claim uniform performance across them.
- The project provides model-loading and generation examples rather than a documented hosted inference API.
- Ordinary generation examples use Transformers; DeepSpeed and Megatron-LM are identified in the context of pretraining.
- The shown generation example uses
.cuda(device)without defining the device variable.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Generate text from a prompt with Transformers
Load mGPT and produce a continuation from a text prompt using the repository’s Python example.
Before you start
- Python environment set up with the repository requirements using
pip install -r requirements.txt. - The Hugging Face Transformers library and access to the
sberbank-ai/mGPTtokenizer and model referenced in the README. - A prompt in a language listed by the project.
Steps
Load
GPT2TokenizerandGPT2LMHeadModelfromsberbank-ai/mGPT.Encode the prompt with the tokenizer.
Pass the resulting input IDs to
model.generatewith generation settings such as the README’s listed length and sampling parameters.Decode the generated output with the tokenizer.
Expected outcome
A decoded text continuation from the supplied prompt.
Guide limitations
- The README example calls
.cuda(device)but does not definedeviceor document hardware requirements; it does not provide a CPU-specific alternative. - The example’s generation parameters are examples, not a guarantee of output quality across languages.
- The repository does not document a hosted API for this task.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 18 October 2026
- Original website title
- ai-forever/mgpt · Official homepage title · retained in its source language

