Skip to main content
simpleT5

Quickly train T5/mT5/byT5 models in just 3 lines of code

PyPI version Stars Stats License

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

# It's advisable to create a new python environment and install simplet5
pip install --upgrade simplet5

Usage

simpleT5 for summarization task Open In Collab

# import
from simplet5 import SimpleT5

# instantiate
model = SimpleT5()

# load (supports t5, mt5, byT5 models)
model.from_pretrained("t5","t5-base")

# train
model.train(train_df=train_df, # pandas dataframe with 2 columns: source_text & target_text
            eval_df=eval_df, # pandas dataframe with 2 columns: source_text & target_text
            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
            )

# load trained T5 model
model.load_model("t5","path/to/trained/model/directory", use_gpu=False)

# predict
model.predict("input text for prediction")

Articles

Acknowledgements

Metadata

Release files for simplet5 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simplet5 0.1.4
File Size Uploaded
simplet5-0.1.4.tar.gz 7.3 kB Details

Release files / simplet5-0.1.4.tar.gz

Download URL simplet5-0.1.4.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e9ac2698f9eae592eb8e079cb7a8f216720d3c8205248b4ebbb047e2d8b51b82
BLAKE2b-256 checksum
How to use checksums
97baf004b1ffd0bb6147ac19b6b58548e13fa1e3bfebaa5030370d5fee5de648
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release history Release notifications | RSS feed

This release

0.1.4 This release

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.9

1 release file

0.0.7

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page