The T5 library loads data, trains, fine-tunes, evaluates, and decodes text-to-text Transformer models, with released checkpoints from the original research.
Overview
T5 (Text-To-Text Transfer Transformer) is a research codebase accompanying work on a unified text-to-text framework for transfer learning in NLP. The bundled t5 Python library supports reproducing paper experiments, fine-tuning released checkpoints, and building on shared modules for training and evaluation.
The data stack defines Task objects that wire data sources, text preprocessors, SentencePiece tokenization, and metric functions, including mixtures for multi-task training. Integrations cover TensorFlow Datasets, text-line files, and TensorFlow Datasets-based corpora such as C4 for unsupervised pre-training.
Model access includes a Mesh TensorFlow path for large-scale TPU training and an experimental Hugging Face PyTorch shim for single-GPU fine-tuning. Command-line flows cover pre-training, fine-tuning with gin configs, evaluation, decoding from input files, and SavedModel export for serving.
New users are directed toward T5X in JAX and Flax for active development; the TensorFlow MeshTF stack in this tree is no longer actively developed. A free Colab tutorial is offered as the quickest hands-on entry point.
Key features
- Text-to-text Task and Mixture API
- TFDS and text-line data sources
- Fine-tuning released checkpoints
- Gin-configured training and eval
- Beam, greedy, and sample decoding
- SavedModel export for serving
- Mesh TensorFlow and experimental PyTorch shim
- Released pre-trained model configs
Use cases
- Fine-tuning T5 on custom text tasks
- Reproducing NLP benchmark experiments
- Multi-task mixture training
- Batch inference from text inputs
- Exporting models for ML serving