Documentation and news: happytransformer.com
Happy Transformer makes it easy to fine-tune and perform inference with NLP Transformer models.
Read about the full 3.0.0 update including breaking changes here.
Tasks | Inference | Training |
---|---|---|
Text Generation | ✔ | ✔ |
Text Classification | ✔ | ✔ |
Word Prediction | ✔ | ✔ |
Question Answering | ✔ | ✔ |
Text-to-Text | ✔ | ✔ |
Next Sentence Prediction | ✔ | |
Token Classification | ✔ |
pip install happytransformer
from happytransformer import HappyWordPrediction
#--------------------------------------#
happy_wp = HappyWordPrediction() # default uses distilbert-base-uncased
result = happy_wp.predict_mask("I think therefore I [MASK]")
print(result) # [WordPredictionResult(token='am', score=0.10172799974679947)]
print(result[0].token) # am
Text generation with training (GPT-Neo)
Text classification (training)
Text classification (hate speech detection)
Text classification (sentiment analysis)