Giter Club home page Giter Club logo

belgpt2's Introduction

Belgian GPT-2 🇧🇪

A GPT-2 model pre-trained on a very large and heterogeneous French corpus (~60Gb).

Usage

You can use BelGPT-2 with 🤗 Transformers library as follows:

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)

Documentation

Detailed documentation on the pre-trained model, its implementation, and the data can be found here.

Citation

For attribution in academic contexts, please cite this work as:

@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}},
}

belgpt2's People

Contributors

ant-louis avatar

Stargazers

Thameur Hamzaoui avatar Oussama Boussif avatar  avatar  avatar Yacine Zahidi avatar Espoir Murhabazi avatar Maxime Golfier avatar  avatar  avatar Adrien Carpentier avatar Victor Delvigne avatar Boris avatar Valentin Macé avatar ktx avatar Camille Louédoc-Eyriès avatar Fabian Frei avatar Levi Monteiro Martins avatar  avatar Daniel Borek avatar Gérard Rozsavolgyi avatar Gilles Louppe avatar  avatar Xavier Fontaine avatar William avatar martindh avatar  avatar GCH avatar  avatar Sylvestre Bouchot avatar Nathan Greffe avatar Tom Crasset avatar

Watchers

James Cloos avatar  avatar

belgpt2's Issues

Entrainement avec OSCAR

Bonjour,

Tout d'abord un grand merci pour le travail, c'est génial d'avoir un GPT en francais

Un autre modèle français, CamemBert (https://camembert-model.fr/), existe. Il est basé sur BERT de Facebook, mais ça n'est pas un vrai langage model (voir https://datascience.stackexchange.com/questions/74115/is-bert-a-language-model https://ai.stackexchange.com/questions/9141/can-bert-be-used-for-sentence-generating-tasks), il ne peut donc pas générer du texte par exemple.

Je porte ceci a ton attention car je me dis que le dataset utilisé pour entraîner CamemBERT pourrait peut-être être utilisé pour améliorer belgpt2. Il s'agit d'OSCAR, un dataset multilingue, trouvable ici https://oscar-corpus.com/.

La version francaise contient 282Go de texte.
Je peux aider a préparer le dataset, si besoin

En te remerciant encore pour ton travail :)

Question générale et prompt

Bonjour,

j'aurais deux questions :

  1. Est-ce que ce modèle fait suite à la publication d'un papier ? Et si oui, serait-il possible d'avoir une référence ?
  2. J'aimerais tester le modèle en influançant la génération par un prompt, est-ce que c'est possible de le faire ?

Sinon bravo pour ce travail, j'ai un peu joué avec les paramètres pour savoir ce que ça donnait, c'est vraiment bien.

Perplexity higher than GPT2 paper

In the GPT2 paper, the authors report a perplexity of ~16 for GPT2-small trained on the WebText dataset. Several open-source projects in several languages also achieve a similar performance (perplexity around 20-30). In the README, we can see that the model doesn't go below 52 of perplexity, do you know what could be the reason of this ?

I tested your pretrained model available in the HuggingFace Hub, and observed that there is no correlation whatsoever between consecutive sentences. Each sentence on its own bears a meaning, but they do not work together, resulting in an incomprehensible piece of text. Here are some example of sentences I generated with the code you provide on the README:

GPT2 est le programme de formation de la police fédérale et de police locale des Pays-Bas. Et comme les jeux d' argent fonctionnent, ils attirent beaucoup de gens dans les casinos en ligne. Le nouveau Premier ministre, dont on sait qu' il a été reçu par son homologue russe Vladimir Poutine, " avait déjà prévenu qu' il fallait tenir compte de la situation sur le terrain et il y avait encore quelque chose d' important en suspens. " Si vous ne voulez pas aller voir un

GPT2 est de l ordre de 0,183, la différence avec la différence entre les valeurs ( et donc la masse ) de charges partielles, donc un gain à mesurer par rapport aux charges partielles, que l on prend comme valeur de l énergie cinétique. Une fois n' est pas coutume, ce sera une autre fois. Un petit côté pop, presque disco mais efficace. Les photos et les descriptions sont conformes à la réalité. C' est cette même dynamique, ce même désir de toujours

Could this explain why the perplexity is that high ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.