Skip to content

Commit 0aa07e6

Browse files
authored
Merge pull request #15 from hpcaitech/feature/zhdoc
made some modifications to the documents
2 parents ccb4488 + 05e7069 commit 0aa07e6

21 files changed

+86
-119
lines changed

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# ColossalAI
1+
# Colossal-AI
22

33
An integrated large-scale model training system with efficient parallelization techniques.
44

5-
arXiv: [Colossal-AI: A Unified Deep Learning System For Large-Scale Parallel Training](https://arxiv.org/abs/2110.14883)
5+
Paper: [Colossal-AI: A Unified Deep Learning System For Large-Scale Parallel Training](https://arxiv.org/abs/2110.14883)
6+
7+
Blog: [Colossal-AI: A Unified Deep Learning System For Large-Scale Parallel Training](https://www.hpcaitech.com/blog)
68

79
## Installation
810

@@ -91,16 +93,25 @@ class MLP_2D(nn.Module):
9193

9294
## Features
9395

94-
ColossalAI provides a collection of parallel training components for you. We aim to support you to write your
96+
Colossal-AI provides a collection of parallel training components for you. We aim to support you to write your
9597
distributed deep learning models just like how you write your single-GPU model. We provide friendly tools to kickstart
9698
distributed training in a few lines.
9799

98100
- [Data Parallelism](./docs/parallelization.md)
99101
- [Pipeline Parallelism](./docs/parallelization.md)
100102
- [1D, 2D, 2.5D, 3D and sequence parallelism](./docs/parallelization.md)
101-
- [friendly trainer and engine](./docs/trainer_engine.md)
103+
- [Friendly trainer and engine](./docs/trainer_engine.md)
102104
- [Extensible for new parallelism](./docs/add_your_parallel.md)
103105
- [Mixed Precision Training](./docs/amp.md)
104106
- [Zero Redundancy Optimizer (ZeRO)](./docs/zero.md)
105107

108+
## Cite Us
106109

110+
```
111+
@article{bian2021colossal,
112+
title={Colossal-AI: A Unified Deep Learning System For Large-Scale Parallel Training},
113+
author={Bian, Zhengda and Liu, Hongxin and Wang, Boxiang and Huang, Haichen and Li, Yongbin and Wang, Chuanrui and Cui, Fan and You, Yang},
114+
journal={arXiv preprint arXiv:2110.14883},
115+
year={2021}
116+
}
117+
```

docs/add_your_parallel.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Overview
44

5-
To enable researchers and engineers to extend our framework to other novel large-scale distributed training algorithm
5+
To enable researchers and engineers to extend our system to other novel large-scale distributed training algorithm
66
with less effort, we have decoupled various components in the training lifecycle. You can implement your own
77
parallelism by simply inheriting from the base class.
88

@@ -15,7 +15,7 @@ The main components are:
1515
## Process Group Initializer
1616

1717
Parallelism is often managed by process groups where processes involved in the same parallel algorithm are placed in the same
18-
process group. For different parallel algorithms, different process groups need to be created. ColossalAI provides a
18+
process group. For different parallel algorithms, different process groups need to be created. Colossal-AI provides a
1919
global context for users to easily manage their process groups. If you wish to add new process group, you can easily
2020
define a new class and set it in your configuration file. To define your own way of creating process groups, you can
2121
follow the steps below to create a new distributed initialization.
@@ -110,7 +110,7 @@ dist_initializer = [
110110

111111
## Schedule
112112

113-
Schedule entails how to execute a forward and backward pass. Currently, ColossalAI provides pipeline and non-pipeline
113+
Schedule entails how to execute a forward and backward pass. Currently, Colossal-AI provides pipeline and non-pipeline
114114
schedules. If you want to modify how the forward and backward passes are executed, you can
115115
inherit `colossalai.engine.BaseSchedule` and implement your idea. You can also add your schedule to the engine before
116116
training.

docs/add_your_parallel_zh.md

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# 添加新的并行技术
22

3-
为了方便科研人员和工程师们更方便地拓展我们的框架来兼容一些新的大规模分布式训练算法,我们对训练过程中的几个组件进行了解耦,您可以通过继承基类的方式
4-
来实现新的并行技术。
3+
为了方便科研人员和工程师们更方便地拓展我们的系统来兼容一些新的大规模分布式训练算法,我们对训练过程中的几个组件进行了解耦,您可以通过继承基类的方式来实现新的并行技术。
54

65
主要的组件如下所示:
76

@@ -11,9 +10,7 @@
1110

1211
## 进程组初始化器
1312

14-
并行化一般是通过进程组来进行管理的,同属于一个并行化算法的进程将被分到一个进程组中,如果系统中存在多种不同的并行化技术,那么需要创建多个不同的进程组。
15-
ColossalAI为用户提供了一个全局上下文变量来便捷地管理他们的进程组。如果您希望增加新的进程组,您可以定义一个新的类并且在您的配置文件中进行设置。下方的
16-
代码块中介绍了如果在系统中加入您的新并行技术以及如何进行初始化。
13+
并行化一般是通过进程组来进行管理的,同属于一个并行化算法的进程将被分到一个进程组中,如果系统中存在多种不同的并行化技术,那么需要创建多个不同的进程组。Colossal-AI为用户提供了一个全局上下文变量来便捷地管理他们的进程组。如果您希望增加新的进程组,您可以定义一个新的类并且在您的配置文件中进行设置。下方的代码块介绍了如何在系统中加入您的新颖并行技术以及如何进行初始化。
1714

1815
1.`colossalai.context.parallel_mode.ParallelMode`中添加新的并行模式。
1916
```python
@@ -28,9 +25,7 @@ class ParallelMode(Enum):
2825
NEW_MODE = 'new_mode' # define your mode here
2926
```
3027

31-
2. 创建一个`ProcessGroupInitializer`的子类,您可以参考`colossalai.context.dist_group_initializer`中给出的例子。前六个参数将由`ParallelContext`
32-
决定。如果您需要设置新的参数,您可以用新的参数替换下面例子中的`arg1``arg2`。最后,您需要使用`@DIST_GROUP_INITIALIZER.register_module`装饰器
33-
在我们的注册表注册您的初始化器。
28+
2. 创建一个`ProcessGroupInitializer`的子类,您可以参考`colossalai.context.dist_group_initializer`中给出的例子。前六个参数将由`ParallelContext`决定。如果您需要设置新的参数,您可以用新的参数替换下面例子中的`arg1``arg2`。最后,您需要使用`@DIST_GROUP_INITIALIZER.register_module`装饰器在我们的注册表中注册您的初始化器。
3429
```python
3530
# sample initializer class
3631
@DIST_GROUP_INITIALIZER.register_module
@@ -55,14 +50,13 @@ class MyParallelInitializer(ProcessGroupInitializer):
5550
pass
5651
```
5752

58-
在此之后,您可以将您的初始化器插入到当前的mode-to-initialize映射`colossalai.constants.INITIALIZER_MAPPING`中,您也可以通过更改该文件来动态变更名称与
59-
并行模式的映射。
53+
在此之后,您可以将您的初始化器插入到当前的mode-to-initialize映射`colossalai.constants.INITIALIZER_MAPPING`中,您也可以通过更改该文件来动态变更名称与并行模式的映射。
6054

6155
```python
6256
colossalai.constants.INITIALIZER_MAPPING['new_mode'] = 'MyParallelInitializer'
6357
```
6458

65-
3. 在配置文件中设置您的初始化器如果您的初始化器需要参数,您可以自行传入下面的代码可以让`ParallelContext`来创建您的初始化器并初始化您需要的进程组。
59+
3. 在配置文件中设置您的初始化器如果您的初始化器需要参数,您可以自行传入下面的代码可以让`ParallelContext`来创建您的初始化器并初始化您需要的进程组。
6660

6761
```python
6862
parallel = dict(
@@ -73,9 +67,7 @@ parallel = dict(
7367

7468
## 梯度处理器
7569

76-
梯度处理器的功能是对模型参数的梯度进行all-reduce操作。由于不同的并行技术可能需要不同的all-reduce操作,用户们可以通过继承
77-
`colossalai.engine.gradient_handler.BaseGradientHandler`来执行其个性化操作。目前,ColossalAI使用普通的数据并行梯度处理器,该处理器在所有的数据
78-
并行rank上执行all-reduce操作,且当ColossalAI监测到当前系统使用了数据并行时,该处理器会被自动创建。您可以使用下方代码块中的代码添加您自定义的梯度处理器:
70+
梯度处理器的功能是对模型参数的梯度进行all-reduce操作。由于不同的并行技术可能需要不同的all-reduce操作,用户们可以通过继承`colossalai.engine.gradient_handler.BaseGradientHandler`来执行其个性化操作。目前,Colossal-AI使用普通的数据并行梯度处理器,该处理器在所有的数据并行rank上执行all-reduce操作,且当Colossal-AI检测到当前系统使用了数据并行时,该处理器会被自动创建。您可以使用下方代码块中的代码添加您自定义的梯度处理器:
7971

8072
```python
8173
from colossalai.registry import GRADIENT_HANDLER
@@ -99,5 +91,4 @@ dist_initializer = [
9991

10092
## 调度器
10193

102-
调度器中指定了在前向传播和后向传播时需要执行哪些操作,ColossalAI提供了支持流水线和不支持流水线的调度器。如果您想要修改前向传播和后向传播的执行方式,您可以
103-
继承`colossalai.engine.BaseSchedule`并实现您想要的操作。您也可以在训练模型之前将您的调度器添加到我们的引擎中来。
94+
调度器中指定了在前向传播和后向传播时需要执行哪些操作,Colossal-AI提供了流水线和非流水线的调度器。如果您想要修改前向传播和后向传播的执行方式,您可以继承`colossalai.engine.BaseSchedule`并实现您想要的操作。您也可以在训练模型之前将您的调度器添加到我们的引擎中来。

docs/amp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Mixed precision training
22

3-
In ColossalAI, we have incorporated different implementations of mixed precision training:
3+
In Colossal-AI, we have incorporated different implementations of mixed precision training:
44
1. torch.cuda.amp
55
2. apex.amp
66
3. tensor-parallel amp

docs/amp_zh.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
# 混合精度训练
22

3-
ColossalAI可以使用如下三种不同的混合精度训练方式
3+
Colossal-AI可以使用如下三种不同的混合精度训练方式
44
1. torch.cuda.amp
55
2. apex.amp
66
3. 张量并行AMP
77

8-
前两种混合精度训练方式依赖于[PyTorch](https://pytorch.org/docs/stable/amp.html)的原生实现(1.6或以上版本)以及
9-
[Nvidia Apex](https://github.com/NVIDIA/apex),但这两种方法与张量并行并不兼容,因为在张量并行中我们需要将张量进行切分并保存在不同的设备上,
10-
因此,实现兼容张量并行的混合精度训练需要在不同进程之间不断通信来交流`inf`以及`nan`是否存在于模型参数中,因此我们才用了
11-
[Megatron-LM](https://github.com/NVIDIA/Megatron-LM)的实现方式。
8+
前两种混合精度训练方式依赖于[PyTorch](https://pytorch.org/docs/stable/amp.html)的原生实现(1.6或以上版本)以及[Nvidia Apex](https://github.com/NVIDIA/apex),但这两种方法与张量并行并不兼容,因为在张量并行中我们需要将张量进行切分并保存在不同的设备上,因此,实现兼容张量并行的混合精度训练需要在不同进程之间不断通信来交流`inf`以及`nan`是否存在于模型参数中,因此我们采用了[Megatron-LM](https://github.com/NVIDIA/Megatron-LM)的实现方式。
129

13-
您可以简单地将配置文件中的`fp16`字段设置为True来使用混合精度训练。目前,PyTorch与Apex的amp不能保证与张量和流水线并行兼容,因此,我们推荐您使用
14-
最后一种混合精度训练方式。
10+
您可以简单地将配置文件中的`fp16`字段设置为True来使用混合精度训练。目前,PyTorch与Apex的amp不能保证与张量和流水线并行兼容,因此,我们推荐您使用最后一种混合精度训练方式。
1511

1612
## PyTorch AMP
1713

18-
PyTorch在1.6及以上版本中提供了混合精度训练,其可以在保持一些操作的精度为`fp32`的同时,将数据转换成`fp16`格式,您可以在配置文件中配置使用。
14+
PyTorch在1.6及以上版本中提供了混合精度训练,它可以在保持一些操作的精度为`fp32`的同时,将数据转换成`fp16`格式,您可以在配置文件中配置使用。
1915

2016
```python
2117
from colossalai.engine import AMP_TYPE
@@ -33,8 +29,7 @@ fp16=dict(
3329

3430
## Apex AMP
3531

36-
我们使用了[Apex](https://nvidia.github.io/apex/)中的混合精度训练,因为该模式提供了细粒度的混合精度控制,例如,`O2`级(第二级优化器)将会保持
37-
批标准化在`fp32`上进行。下面的代码块展示了使用Apex AMP的配置文件。
32+
我们使用了[Apex](https://nvidia.github.io/apex/)中的混合精度训练,因为该模式提供了细粒度的混合精度控制,例如,`O2`级(第二级优化器)将会保持批标准化在`fp32`上进行。下面的代码块展示了使用Apex AMP的配置文件。
3833

3934
```python
4035
from colossalai.engine import AMP_TYPE
@@ -59,7 +54,7 @@ fp16 = dict(
5954

6055
## 张量并行AMP
6156

62-
我们借鉴了Megatron-LM的混合精度训练实现,该实现方式与张量并行与流水线并行相兼容。下面的代码块展示了使用张量并行AMP的配置文件。
57+
我们借鉴了Megatron-LM的混合精度训练实现,该实现方式与张量并行、流水线并行相兼容。下面的代码块展示了使用张量并行AMP的配置文件。
6358

6459
```python
6560
from colossalai.engine import AMP_TYPE

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# -- Project information -----------------------------------------------------
1919

20-
project = 'ColossalAI'
20+
project = 'Colossal-AI'
2121
copyright = '2021, HPC-AI Tech'
2222
author = 'HPC-AI Technology Inc.'
2323

docs/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Config file
22

3-
Here is a config file example showing how to train a ViT model on the CIFAR10 dataset using ColossalAI:
3+
Here is a config file example showing how to train a ViT model on the CIFAR10 dataset using Colossal-AI:
44

55
```python
66
# build train_dataset and train_dataloader from this dictionary

docs/config_zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 配置文件
22

3-
下方代码块中的示例展示了如何在CIFAR10数据集上使用ColossalAI训练ViT模型
3+
下方代码块中的示例展示了如何在CIFAR10数据集上使用Colossal-AI训练ViT模型
44

55
```python
66
# build train_dataset and train_dataloader from this dictionary

docs/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
.. ColossalAI documentation master file, created by
1+
.. Colossal-AI documentation master file, created by
22
sphinx-quickstart on Mon Oct 11 17:05:05 2021.
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
ColossalAI开发文档
6+
夸父AI系统(Colossal-AI)开发文档
77
======================================
88
.. toctree::
99
:maxdepth: 1

docs/index_en.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
.. ColossalAI documentation master file, created by
1+
.. Colossal-AI documentation master file, created by
22
sphinx-quickstart on Mon Oct 11 17:05:05 2021.
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
ColossalAI documentation
6+
Colossal-AI documentation
77
======================================
88
.. toctree::
99
:maxdepth: 1

0 commit comments

Comments
 (0)