BMTrain  by OpenBMB

Training toolkit for large AI models

created 3 years ago
603 stars

Top 55.0% on sourcepulse

GitHubView on GitHub
Project Summary

BMTrain is an open-source toolkit designed for efficient large-scale model training, including pre-training and fine-tuning. It targets researchers and engineers working with models containing tens of billions of parameters, simplifying distributed training to feel like stand-alone development.

How It Works

BMTrain integrates with PyTorch, enabling distributed training through its init_distributed function, replacing PyTorch's native distributed module. It implements ZeRO optimization by requiring users to replace torch.nn.Module with bmtrain.DistributedModule and torch.nn.Parameter with bmtrain.DistributedParameter. Transformer blocks can be further optimized by wrapping them in bmtrain.Block with specified ZeRO levels. Communication overhead is reduced by using bmtrain.TransformerBlockList for sequential blocks.

Quick Start & Requirements

  • Installation: pip install bmtrain (compiles C/CUDA source code, may take 5-10 minutes).
  • Prerequisites: PyTorch, CUDA (implied by compilation).
  • Usage: Initialize with bmt.init_distributed(), replace PyTorch modules with BMTrain equivalents, and launch using torch.distributed.launch or torchrun.
  • Documentation: https://www.openbmb.org/ (linked via website).

Highlighted Details

  • Supports ZeRO-2 and ZeRO-3 optimizations.
  • Offers bmtrain.optim.AdamOffloadOptimizer and bmtrain.lr_scheduler for optimized training.
  • Provides an OptimManager to handle optimizer zero-grad, backward, clipping, and step operations.
  • Claims significant throughput improvements over standard ZeRO implementations in benchmarks.

Maintenance & Community

Licensing & Compatibility

  • Apache 2.0 License.
  • Permits commercial use and linking with closed-source projects.

Limitations & Caveats

BMTrain makes deep modifications to PyTorch's internals, potentially leading to unexpected behavior. Users are advised to submit issues for any observed problems.

Health Check
Last commit

2 months ago

Responsiveness

1 week

Pull Requests (30d)
0
Issues (30d)
0
Star History
21 stars in the last 90 days

Explore Similar Projects

Starred by Stas Bekman Stas Bekman(Author of Machine Learning Engineering Open Book; Research Engineer at Snowflake).

fms-fsdp by foundation-model-stack

0%
258
Efficiently train foundation models with PyTorch
created 1 year ago
updated 1 week ago
Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Zhuohan Li Zhuohan Li(Author of vLLM), and
6 more.

torchtitan by pytorch

1.0%
4k
PyTorch platform for generative AI model training research
created 1 year ago
updated 1 day ago
Starred by Lewis Tunstall Lewis Tunstall(Researcher at Hugging Face), Patrick von Platen Patrick von Platen(Core Contributor to Hugging Face Transformers and Diffusers), and
5 more.

torchtune by pytorch

0.2%
5k
PyTorch library for LLM post-training and experimentation
created 1 year ago
updated 1 day ago
Feedback? Help us improve.