Skip to content

Boilerplate for TorchText Driven Deep Learning Research with PyTorch Lightning and Lightning Fabric

License

Notifications You must be signed in to change notification settings

jxtngx/lightning-text

Repository files navigation

Text Lab

Overview

Text Lab is a public template for artificial intelligence and machine learning research projects using Lightning AI's PyTorch Lightning to train a lanaguage Transformer that is implemented in PyTorch.

The recommended way for Text Lab users to create new repos is with the use this template button.

Source Module

textlab.core contains code for the Lightning Module and Trainer.

textlab.components contains experiment utilities grouped by purpose for cohesion.

textlab.pipeline contains code for data acquistion and preprocessing, and building a TorchDataset and LightningDataModule.

textlab.serve contains code for model serving APIs built with FastAPI.

textlab.cli contains code for the command line interface built with Typerand Rich.

textlab.config assists with project, trainer, and sweep configurations.

textlab.app contains code for a Streamlit app.

Base Requirements and Extras

Text Lab installs minimal requirements out of the box, and provides extras to make creating robust virtual environments easier. To view the requirements, in setup.cfg, see install_requires for the base requirements and options.extras_require for the available extras.

The recommended install is as follows:

python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[all]"

Using Text Lab

Text Lab also enables use of a CLI named lab that is built with Typer. This CLI is available in the terminal after install. lab features can be viewed with:

lab --help

A fast dev run cab be ran with:

lab run dev-run

A longer demo run can be inititated with:

lab run demo-run

Weights and Biases

If you have a Weights and Biases account, you can override the default CSV logger and use wanbd with:

lab run demo-run --logger wandb

Streamlit

Stay tuned for the Streamlit app!