2022-11-12 10:24:52 +00:00
# Multi-dimensional Parallelism with Colossal-AI
2022-11-11 09:08:17 +00:00
2023-01-11 07:17:17 +00:00
## Table of contents
2022-11-11 09:08:17 +00:00
2023-01-11 07:17:17 +00:00
- [Overview ](#-overview )
- [Quick Start ](#-quick-start )
2022-11-14 11:49:32 +00:00
2023-01-11 07:17:17 +00:00
## 📚 Overview
2022-11-14 11:49:32 +00:00
2023-01-11 07:17:17 +00:00
This example lets you to quickly try out the hybrid parallelism provided by Colossal-AI.
You can change the parameters below to try out different settings in the `config.py` .
2022-11-14 11:49:32 +00:00
2023-01-11 07:17:17 +00:00
```python
# parallel setting
TENSOR_PARALLEL_SIZE = 2
TENSOR_PARALLEL_MODE = '1d'
2022-11-11 09:08:17 +00:00
2023-01-11 07:17:17 +00:00
parallel = dict(
pipeline=2,
tensor=dict(mode=TENSOR_PARALLEL_MODE, size=TENSOR_PARALLEL_SIZE),
)
2022-11-11 09:08:17 +00:00
```
2023-01-11 07:17:17 +00:00
## 🚀 Quick Start
2022-11-11 09:08:17 +00:00
2023-01-11 07:17:17 +00:00
1. Install PyTorch
2022-11-11 09:08:17 +00:00
2023-01-11 07:17:17 +00:00
2. Install the dependencies.
2022-11-11 09:08:17 +00:00
```bash
2023-01-11 07:17:17 +00:00
pip install -r requirements.txt
2022-11-11 09:08:17 +00:00
```
2023-01-11 07:17:17 +00:00
3. Run the training scripts with synthetic data.
2022-11-11 09:08:17 +00:00
```bash
colossalai run --nproc_per_node 4 train.py --config config.py
2022-11-12 10:18:55 +00:00
```
2023-01-11 07:17:17 +00:00
4. Modify the config file to play with different types of tensor parallelism, for example, change tensor parallel size to be 4 and mode to be 2d and run on 8 GPUs.