Text Generation
Transformers
PyTorch
gpt2
multilingual
PyTorch
Transformers
gpt3
Deepspeed
Megatron
text-generation-inference
Instructions to use ai-forever/mGPT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ai-forever/mGPT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ai-forever/mGPT")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ai-forever/mGPT") model = AutoModelForCausalLM.from_pretrained("ai-forever/mGPT") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ai-forever/mGPT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ai-forever/mGPT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ai-forever/mGPT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ai-forever/mGPT
- SGLang
How to use ai-forever/mGPT with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ai-forever/mGPT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ai-forever/mGPT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ai-forever/mGPT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ai-forever/mGPT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ai-forever/mGPT with Docker Model Runner:
docker model run hf.co/ai-forever/mGPT
Update README.md
#8
by vmkhlv - opened
README.md
CHANGED
|
@@ -78,7 +78,7 @@ datasets:
|
|
| 78 |
thumbnail: "https://github.com/sberbank-ai/mgpt"
|
| 79 |
---
|
| 80 |
|
| 81 |
-
#
|
| 82 |
|
| 83 |
We introduce a family of autoregressive GPT-like models with 1.3 billion parameters trained on 61 languages from 25 language families using Wikipedia and Colossal Clean Crawled Corpus.
|
| 84 |
|
|
@@ -88,32 +88,33 @@ We reproduce the GPT-3 architecture using GPT-2 sources and the sparse attention
|
|
| 88 |
The source code for the mGPT XL model is available on [Github](https://github.com/sberbank-ai/mgpt)
|
| 89 |
|
| 90 |
## Paper
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
[Abstract](https://arxiv.org/abs/2204.07580) [PDF](https://arxiv.org/pdf/2204.07580.pdf)
|
| 94 |
|
| 95 |
-

|
| 96 |
-
|
| 97 |
```
|
| 98 |
-
@
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
| 114 |
}
|
| 115 |
-
|
| 116 |
-
```
|
| 117 |
|
| 118 |
|
| 119 |
## Languages
|
|
|
|
| 78 |
thumbnail: "https://github.com/sberbank-ai/mgpt"
|
| 79 |
---
|
| 80 |
|
| 81 |
+
# mGPT 1.3B
|
| 82 |
|
| 83 |
We introduce a family of autoregressive GPT-like models with 1.3 billion parameters trained on 61 languages from 25 language families using Wikipedia and Colossal Clean Crawled Corpus.
|
| 84 |
|
|
|
|
| 88 |
The source code for the mGPT XL model is available on [Github](https://github.com/sberbank-ai/mgpt)
|
| 89 |
|
| 90 |
## Paper
|
| 91 |
+
|
| 92 |
+
**mGPT: Few-Shot Learners Go Multilingual**
|
| 93 |
+
|
| 94 |
+
Published at TACL 2024 (MIT Press). Presented at EMNLP 2023.
|
| 95 |
|
| 96 |
[Abstract](https://arxiv.org/abs/2204.07580) [PDF](https://arxiv.org/pdf/2204.07580.pdf)
|
| 97 |
|
|
|
|
|
|
|
| 98 |
```
|
| 99 |
+
@article{shliazhko-etal-2024-mgpt,
|
| 100 |
+
title = "m{GPT}: Few-Shot Learners Go Multilingual",
|
| 101 |
+
author = "Shliazhko, Oleh and
|
| 102 |
+
Fenogenova, Alena and
|
| 103 |
+
Tikhonova, Maria and
|
| 104 |
+
Kozlova, Anastasia and
|
| 105 |
+
Mikhailov, Vladislav and
|
| 106 |
+
Shavrina, Tatiana",
|
| 107 |
+
journal = "Transactions of the Association for Computational Linguistics",
|
| 108 |
+
volume = "12",
|
| 109 |
+
year = "2024",
|
| 110 |
+
address = "Cambridge, MA",
|
| 111 |
+
publisher = "MIT Press",
|
| 112 |
+
url = "https://aclanthology.org/2024.tacl-1.4",
|
| 113 |
+
doi = "10.1162/tacl_a_00633",
|
| 114 |
+
pages = "58--79",
|
| 115 |
+
abstract = "This paper introduces mGPT, a multilingual variant of GPT-3, pretrained on 61 languages from 25 linguistically diverse language families using Wikipedia and the C4 Corpus. We detail the design and pretraining procedure. The models undergo an intrinsic and extrinsic evaluation: language modeling in all languages, downstream evaluation on cross-lingual NLU datasets and benchmarks in 33 languages, and world knowledge probing in 23 languages. The in-context learning abilities are on par with the contemporaneous language models while covering a larger number of languages, including underrepresented and low-resource languages of the Commonwealth of Independent States and the indigenous peoples in Russia. The source code and the language models are publicly available under the MIT license.",
|
| 116 |
}
|
| 117 |
+
```
|
|
|
|
| 118 |
|
| 119 |
|
| 120 |
## Languages
|