ColossalAI/examples/tutorial/large_batch_optimizer
Hongxin Liu 079bf3cb26
[misc] update pre-commit and run all files (#4752)
* [misc] update pre-commit

* [misc] run pre-commit

* [misc] remove useless configuration files

* [misc] ignore cuda for clang-format
2023-09-19 14:20:26 +08:00
..
README.md [example] integrate seq-parallel tutorial with CI (#2463) 2023-01-13 14:40:05 +08:00
config.py [legacy] clean up legacy code (#4743) 2023-09-18 16:31:06 +08:00
requirements.txt [example] updated large-batch optimizer tutorial (#2448) 2023-01-11 16:27:31 +08:00
test_ci.sh [legacy] clean up legacy code (#4743) 2023-09-18 16:31:06 +08:00
train.py [misc] update pre-commit and run all files (#4752) 2023-09-19 14:20:26 +08:00

README.md

Large Batch Training Optimization

Table of contents

📚 Overview

This example lets you to quickly try out the large batch training optimization provided by Colossal-AI. We use synthetic dataset to go through the process, thus, you don't need to prepare any dataset. You can try out the Lamb and Lars optimizers from Colossal-AI with the following code.

from colossalai.nn.optimizer import Lamb, Lars

🚀 Quick Start

  1. Install PyTorch

  2. Install the dependencies.

pip install -r requirements.txt
  1. Run the training scripts with synthetic data.
# run on 4 GPUs
# run with lars
colossalai run --nproc_per_node 4 train.py --config config.py --optimizer lars

# run with lamb
colossalai run --nproc_per_node 4 train.py --config config.py --optimizer lamb