Quickly train T5/mT5/byT5 models in just 3 lines of code
simpleT5 is built on top of PyTorch-lightning⚡️ and Transformers🤗 that lets you quickly train your T5 models.
T5 models can be used for several NLP tasks such as summarization, QA , QG , translation , text generation, and more.
Here's a link to Medium article along with an example colab notebook
Install
pip install --upgrade simplet5
Usage
simpleT5 for summarization task
from simplet5 import SimpleT5
model = SimpleT5()
model.from_pretrained("t5","t5-base")
model.train(train_df=train_df,
eval_df=eval_df,
source_max_token_len = 512,
target_max_token_len = 128,
batch_size = 8,
max_epochs = 5,
use_gpu = True,
outputdir = "outputs",
early_stopping_patience_epochs = 0,
precision = 32
)
model.load_model("t5","path/to/trained/model/directory", use_gpu=False)
model.predict("input text for prediction")
Articles
Acknowledgements