模型:
使用一个非常大且多样化的法语语料库(约60GB)预训练的GPT-2模型。
您可以使用 🤗 transformers 与BelGPT-2:
import torch
from transformers import GPT2Tokenizer, GPT2LMHeadModel
# Load pretrained model and tokenizer
model = GPT2LMHeadModel.from_pretrained("antoiloui/belgpt2")
tokenizer = GPT2Tokenizer.from_pretrained("antoiloui/belgpt2")
# Generate a sample of text
model.eval()
output = model.generate(
bos_token_id=random.randint(1,50000),
do_sample=True,
top_k=50,
max_length=100,
top_p=0.95,
num_return_sequences=1
)
# Decode it
decoded_output = []
for sample in output:
decoded_output.append(tokenizer.decode(sample, skip_special_tokens=True))
print(decoded_output)
以下是用于预训练该模型的所有法语语料库的列表:
| Dataset | $corpus_name | Raw size | Cleaned size |
|---|---|---|---|
| CommonCrawl | common_crawl | 200.2 GB | 40.4 GB |
| NewsCrawl | news_crawl | 10.4 GB | 9.8 GB |
| Wikipedia | wiki | 19.4 GB | 4.1 GB |
| Wikisource | wikisource | 4.6 GB | 2.3 GB |
| Project Gutenberg | gutenberg | 1.3 GB | 1.1 GB |
| EuroParl | europarl | 289.9 MB | 278.7 MB |
| NewsCommentary | news_commentary | 61.4 MB | 58.1 MB |
| Total | 236.3 GB | 57.9 GB |
有关预训练模型、其实现和数据的详细文档可以在此处找到 here 。
在学术环境中引用此作品时,请将其作为:
@misc{louis2020belgpt2,
author = {Louis, Antoine},
title = {{BelGPT-2: a GPT-2 model pre-trained on French corpora.}},
year = {2020},
howpublished = {\url{https://github.com/antoiloui/belgpt2}},
}
进行归因。