Litgpt
LitGPT is an open-source framework developed by Lightning AI designed for pretraining, finetuning, and deploying over 20 large language models (LLMs) using from-scratch implementations without abstractions. It supports scalable training across 1 to over 1000 GPUs or TPUs and offers configurable workflows through YAML files, enabling users to customize parameters such as batch sizes and LoRA finetuning. The tool emphasizes resource optimization with features like Flash Attention, Fully Sharded Data Parallel (FSDP), and mixed precision support (fp4/8/16/32). The codebase is modular and readable, consisting of over 44,000 lines of Python code, and is accompanied by extensive documentation and tutorials aimed at developers and researchers working with natural language processing models. LitGPT operates primarily via command-line interfaces and requires manual setup through cloning its GitHub repository and installing dependencies. It is distributed under an open-source license and does not have a dedicated standalone website, with primary resources hosted on GitHub and Lightning AI's documentation portal.
LitGPT is an open-source tool for scalable pretraining, finetuning, and deployment of large language models with multi-GPU/TPU support.
Pretraining Large Language Models
Researchers or developers can pretrain LLMs from scratch on custom datasets using scalable multi-GPU setups.
Finetuning with LoRA
Users can finetune existing models with parameter-efficient LoRA techniques to adapt models to specific tasks or domains.
Deploying Custom LLMs
After training or finetuning, models can be deployed and tested locally via command-line interfaces for inference.
litgpt download EleutherAI/pythia-160m --tokenizer_only True to download the tokenizer for a model.litgpt pretrain EleutherAI/pythia-160m --tokenizer_dir EleutherAI/pythia-160m --data TextFiles --data.train_data_path "custom_texts/" --train.max_tokens 10_000_000 --out_dir out/custom-model.litgpt finetune lora --config config_hub/finetune/phi-2/lora.yaml.litgpt chat out/custom-model/final.