Skip to content
Merged

Ra #8

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8257e10
[chat]polish prompts training (#3300)
ht-zhou Mar 29, 2023
e235a24
[application] updated the README (#3301)
FrankLeeeee Mar 29, 2023
31c78f2
[doc] add ColossalChat news (#3304)
binmakeswell Mar 29, 2023
cb413cc
[format] applied code formatting on changed files in pull request 330…
github-actions[bot] Mar 29, 2023
a0b3749
[release] v0.2.8 (#3305)
FrankLeeeee Mar 29, 2023
b512893
Polish readme link (#3306)
ht-zhou Mar 29, 2023
0fbadce
[doc] added authors to the chat application (#3307)
Fazziekey Mar 29, 2023
204ca2f
[NFC] polish colossalai/fx/profiler/experimental/profiler_module/embe…
dayellow Mar 27, 2023
1ff7d5b
[NFC] polish colossalai/engine/gradient_handler/_moe_gradient_handler…
Gy-Lu Mar 27, 2023
488f370
[NFC] polish colossalai/global_variables.py code style (#3259)
flybird11111 Mar 27, 2023
00778ab
[NFC] polish colossalai/fx/passes/split_module.py code style (#3263)
CsRic Mar 27, 2023
c4a226b
[NFC] polish tensor_placement_policy.py code style (#3265)
Camille7777 Mar 27, 2023
d58fa70
[NFC] polish code style (#3268)
chengeharrison Mar 28, 2023
4cadb25
[NFC] policy colossalai/fx/proxy.py code style (#3269)
CZYCW Mar 28, 2023
6b3bb2c
[NFC] polish code style (#3273)
oahzxl Mar 28, 2023
4b95464
[NFC] polish colossalai/amp/__init__.py code style (#3272)
lucasliunju Mar 28, 2023
196d469
[NFC] polish colossalai/nn/_ops/addmm.py code style (#3274)
TongLi3701 Mar 28, 2023
1168b50
[NFC] polish colossalai/engine/schedule/_pipeline_schedule_v2.py code…
ziruizhu Mar 28, 2023
8af977f
[NFC] polish colossalai/context/parallel_context.py code style (#3276)
Arsmart1 Mar 28, 2023
94eec1c
[NFC] polish colossalai/engine/gradient_accumulation/_gradient_accumu…
Sze-qq Mar 28, 2023
964a286
[NFC] polish initializer_3d.py code style (#3279)
kaiwang960112 Mar 28, 2023
1bed38e
[NFC] polish colossalai/cli/benchmark/models.py code style (#3290)
henryqin1997 Mar 28, 2023
1ce9d0c
[NFC] polish initializer_data.py code style (#3287)
yangluo7 Mar 28, 2023
6435002
[NFC] polish colossalai/gemini/paramhooks/_param_hookmgr.py code style
Xu-Kai Mar 29, 2023
ad285e1
[NFC] polish colossalai/fx/tracer/_tracer_utils.py (#3323)
MichelleMa8 Mar 29, 2023
15a74da
[doc] add Intel cooperation news (#3333)
binmakeswell Mar 30, 2023
fbd2a9e
[hotfix] meta_tensor_compatibility_with_torch2
YuliangLiu0306 Mar 30, 2023
82132f4
[chat] correcting a few obvious typos and grammars errors (#3338)
HuitingLiu Mar 30, 2023
198a74b
[NFC] polish colossalai/context/random/__init__.py code style (#3327)
yuxuan-lou Mar 30, 2023
8706a8c
[NFC] polish colossalai/engine/gradient_handler/__init__.py code styl…
ofey404 Mar 30, 2023
e78a1e9
fix torch 2.0 compatibility (#3346)
kurisusnowdeng Mar 30, 2023
fee2af8
[autoparallel] adapt autoparallel with new analyzer (#3261)
YuliangLiu0306 Mar 30, 2023
1a1d68b
[moe] add checkpoint for moe models (#3354)
1SAA Mar 31, 2023
5f2e34e
[booster] implement Gemini plugin (#3352)
ver217 Mar 31, 2023
51cd2fe
Typofix: malformed `xformers` version (#3384)
janroudaut Mar 31, 2023
dd367ce
[doc] polish diffusion example (#3386)
janroudaut Apr 1, 2023
94c24d9
Improve grammar and punctuation (#3398)
TechDjinn Apr 2, 2023
2071350
Merge pull request #7 from hpcaitech/main
jamesthesnake Apr 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[![logo](https://raw.githubusercontent.com/hpcaitech/public_assets/main/colossalai/img/colossal-ai_logo_vertical.png)](https://www.colossalai.org/)

Colossal-AI: Making large AI models cheaper, faster and more accessible
Colossal-AI: Making large AI models cheaper, faster, and more accessible

<h3> <a href="https://arxiv.org/abs/2110.14883"> Paper </a> |
<a href="https://www.colossalai.org/"> Documentation </a> |
Expand All @@ -25,8 +25,10 @@
</div>

## Latest News
* [2023/03] [ColossalChat: An Open-Source Solution for Cloning ChatGPT With a Complete RLHF Pipeline](https://medium.com/@yangyou_berkeley/colossalchat-an-open-source-solution-for-cloning-chatgpt-with-a-complete-rlhf-pipeline-5edf08fb538b)
* [2023/03] [Intel and Colossal-AI Partner to Deliver Cost-Efficient Open-Source Solution for Protein Folding Structure Prediction](https://www.hpc-ai.tech/blog/intel-habana)
* [2023/03] [AWS and Google Fund Colossal-AI with Startup Cloud Programs](https://www.hpc-ai.tech/blog/aws-and-google-fund-colossal-ai-with-startup-cloud-programs)
* [2023/02] [Open source solution replicates ChatGPT training process! Ready to go with only 1.6GB GPU memory](https://www.hpc-ai.tech/blog/colossal-ai-chatgpt)
* [2023/02] [Open Source Solution Replicates ChatGPT Training Process! Ready to go with only 1.6GB GPU Memory](https://www.hpc-ai.tech/blog/colossal-ai-chatgpt)
* [2023/01] [Hardware Savings Up to 46 Times for AIGC and Automatic Parallelism](https://medium.com/pytorch/latest-colossal-ai-boasts-novel-automatic-parallelism-and-offers-savings-up-to-46x-for-stable-1453b48f3f02)
* [2022/11] [Diffusion Pretraining and Hardware Fine-Tuning Can Be Almost 7X Cheaper](https://www.hpc-ai.tech/blog/diffusion-pretraining-and-hardware-fine-tuning-can-be-almost-7x-cheaper)
* [2022/10] [Use a Laptop to Analyze 90% of Proteins, With a Single-GPU Inference Sequence Exceeding 10,000](https://www.hpc-ai.tech/blog/use-a-laptop-to-analyze-90-of-proteins-with-a-single-gpu-inference-sequence-exceeding)
Expand Down Expand Up @@ -113,7 +115,7 @@ distributed training and inference in a few lines.
- [PatrickStar](https://arxiv.org/abs/2108.05818)

- Friendly Usage
- Parallelism based on configuration file
- Parallelism based on the configuration file

- Inference
- [Energon-AI](https://github.com/hpcaitech/EnergonAI)
Expand All @@ -127,7 +129,7 @@ distributed training and inference in a few lines.
<img src="https://raw.githubusercontent.com/hpcaitech/public_assets/main/colossalai/img/GPT3-v5.png" width=700/>
</p>

- Save 50% GPU resources, and 10.7% acceleration
- Save 50% GPU resources and 10.7% acceleration

### GPT-2
<img src="https://raw.githubusercontent.com/hpcaitech/public_assets/main/colossalai/img/GPT2.png" width=800/>
Expand All @@ -149,7 +151,7 @@ distributed training and inference in a few lines.
### OPT
<img src="https://raw.githubusercontent.com/hpcaitech/public_assets/main/colossalai/img/OPT_update.png" width=800/>

- [Open Pretrained Transformer (OPT)](https://github.com/facebookresearch/metaseq), a 175-Billion parameter AI language model released by Meta, which stimulates AI programmers to perform various downstream tasks and application deployments because public pretrained model weights.
- [Open Pretrained Transformer (OPT)](https://github.com/facebookresearch/metaseq), a 175-Billion parameter AI language model released by Meta, which stimulates AI programmers to perform various downstream tasks and application deployments because of public pre-trained model weights.
- 45% speedup fine-tuning OPT at low cost in lines. [[Example]](https://github.com/hpcaitech/ColossalAI/tree/main/examples/language/opt) [[Online Serving]](https://colossalai.org/docs/advanced_tutorials/opt_service)

Please visit our [documentation](https://www.colossalai.org/) and [examples](https://github.com/hpcaitech/ColossalAI/tree/main/examples) for more details.
Expand Down Expand Up @@ -223,7 +225,7 @@ Please visit our [documentation](https://www.colossalai.org/) and [examples](htt
</a>
</div>

[ColossalChat](https://github.com/hpcaitech/ColossalAI/tree/main/applications/Chat): An open-source solution for cloning [ChatGPT](https://openai.com/blog/chatgpt/) with a complete RLHF pipeline. [[code]](https://github.com/hpcaitech/ColossalAI/tree/main/applications/Chat) [[blog]](https://www.hpc-ai.tech/blog/colossal-ai-chatgpt) [[demo]](https://chat.colossalai.org)
[ColossalChat](https://github.com/hpcaitech/ColossalAI/tree/main/applications/Chat): An open-source solution for cloning [ChatGPT](https://openai.com/blog/chatgpt/) with a complete RLHF pipeline. [[code]](https://github.com/hpcaitech/ColossalAI/tree/main/applications/Chat) [[blog]](https://medium.com/@yangyou_berkeley/colossalchat-an-open-source-solution-for-cloning-chatgpt-with-a-complete-rlhf-pipeline-5edf08fb538b) [[demo]](https://chat.colossalai.org)

<p id="ColossalChat_scaling" align="center">
<img src="https://raw.githubusercontent.com/hpcaitech/public_assets/main/applications/chatgpt/ChatGPT%20scaling.png" width=800/>
Expand All @@ -243,7 +245,7 @@ Please visit our [documentation](https://www.colossalai.org/) and [examples](htt
</p>

- Increase the capacity of the fine-tuning model by up to 3.7 times on a single GPU
- Keep in a sufficiently high running speed
- Keep at a sufficiently high running speed

<p align="right">(<a href="#top">back to top</a>)</p>

Expand Down Expand Up @@ -302,7 +304,7 @@ Requirements:
- Python >= 3.7
- CUDA >= 11.0

If you encounter any problem about installation, you may want to raise an [issue](https://github.com/hpcaitech/ColossalAI/issues/new/choose) in this repository.
If you encounter any problem with installation, you may want to raise an [issue](https://github.com/hpcaitech/ColossalAI/issues/new/choose) in this repository.

### Install from PyPI

Expand All @@ -320,9 +322,9 @@ However, if you want to build the PyTorch extensions during installation, you ca
CUDA_EXT=1 pip install colossalai
```

**Otherwise, CUDA kernels will be built during runtime when you actually need it.**
**Otherwise, CUDA kernels will be built during runtime when you actually need them.**

We also keep release the nightly version to PyPI on a weekly basis. This allows you to access the unreleased features and bug fixes in the main branch.
We also keep releasing the nightly version to PyPI every week. This allows you to access the unreleased features and bug fixes in the main branch.
Installation can be made via

```bash
Expand All @@ -331,7 +333,7 @@ pip install colossalai-nightly

### Download From Source

> The version of Colossal-AI will be in line with the main branch of the repository. Feel free to raise an issue if you encounter any problem. :)
> The version of Colossal-AI will be in line with the main branch of the repository. Feel free to raise an issue if you encounter any problems. :)

```shell
git clone https://github.com/hpcaitech/ColossalAI.git
Expand Down Expand Up @@ -421,6 +423,6 @@ To cite this project, you can use the following BibTeX citation.
}
```

Colossal-AI has been accepted as official tutorials by top conference [SC](https://sc22.supercomputing.org/), [AAAI](https://aaai.org/Conferences/AAAI-23/), [PPoPP](https://ppopp23.sigplan.org/), [CVPR](https://cvpr2023.thecvf.com/), [ISC](https://www.isc-hpc.com/), etc.
Colossal-AI has been accepted as official tutorial by top conferences [SC](https://sc22.supercomputing.org/), [AAAI](https://aaai.org/Conferences/AAAI-23/), [PPoPP](https://ppopp23.sigplan.org/), [CVPR](https://cvpr2023.thecvf.com/), [ISC](https://www.isc-hpc.com/), etc.

<p align="right">(<a href="#top">back to top</a>)</p>
66 changes: 45 additions & 21 deletions applications/Chat/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<h1 align="center">
<span>Coati - ColossalAI Talking Intelligence</span>
<img width="auto" height="50px", src="https://raw.githubusercontent.com/hpcaitech/public_assets/main/applications/chat/logo_coati.png"/>
<img width="auto" height="100px", src="https://raw.githubusercontent.com/hpcaitech/public_assets/main/applications/chat/logo_coati.png"/>
<br/>
<span>ColossalChat</span>
</h1>


## Table of Contents

- [Table of Contents](#table-of-contents)
- [What is Coati ?](#what-is-coati-)
- [What is ColossalChat and Coati ?](#what-is-colossalchat-and-coati-)
- [Online demo](#online-demo)
- [Install](#install)
- [Install the environment](#install-the-environment)
Expand All @@ -18,6 +19,8 @@
- [Stage2 - Training reward model](#stage2---training-reward-model)
- [Stage3 - Training model with reinforcement learning by human feedback](#stage3---training-model-with-reinforcement-learning-by-human-feedback)
- [Inference - After Training](#inference---after-training)
- [8-bit setup](#8-bit-setup)
- [4-bit setup](#4-bit-setup)
- [Coati7B examples](#coati7b-examples)
- [Generation](#generation)
- [Open QA](#open-qa)
Expand All @@ -33,30 +36,44 @@
- [Citations](#citations)
- [Licenses](#licenses)
---
## What is Coati ?
## What is ColossalChat and Coati ?

Coati is a large language model developed by Colossal-AI, which is also a unified large language model framework that has implemented the following functions
[ColossalChat](https://github.com/hpcaitech/ColossalAI/tree/main/applications/Chat) is the project to implement LLM with RLHF, powered by the [Colossal-AI](https://github.com/hpcaitech/ColossalAI) project.

Coati stands for `ColossalAI Talking Intelligence`. It is the name for the module implemented in this project and is also the name of the large language model developed by the ColossalChat project.

The Coati package provides a unified large language model framework that has implemented the following functions
- Supports comprehensive large-model training acceleration capabilities for ColossalAI, without requiring knowledge of complex distributed training algorithms
- Supervised datasets collection
- Supervised insturcts fine-tuning
- Supervised instructions fine-tuning
- Training reward model
- Reinforcement learning with human feedback
- Quantization inference
- Fast model deploying
- Perfectly integration with the Hugging Face ecosystem, high degree of model customization
- Perfectly integrated with the Hugging Face ecosystem, a high degree of model customization

<div align="center">
<p align="center">
<img src="https://raw.githubusercontent.com/hpcaitech/public_assets/main/applications/chatgpt/chatgpt.png" width=700/>
</p>

More details can be found in the [blog](https://www.hpc-ai.tech/blog/colossal-ai-chatgpt).
Image source: https://openai.com/blog/chatgpt
</div>

<p align="center">
<img src="https://raw.githubusercontent.com/hpcaitech/public_assets/main/applications/chatgpt/chatgpt.png" width=700/>
</p>
**As Colossa-AI is undergoing some major updates, this project will be actively maintained to stay in line with the Colossal-AI project.**


More details can be found in the latest news.
* [2023/03] [ColossalChat: An Open-Source Solution for Cloning ChatGPT With a Complete RLHF Pipeline](https://medium.com/@yangyou_berkeley/colossalchat-an-open-source-solution-for-cloning-chatgpt-with-a-complete-rlhf-pipeline-5edf08fb538b)
* [2023/02] [Open Source Solution Replicates ChatGPT Training Process! Ready to go with only 1.6GB GPU Memory](https://www.hpc-ai.tech/blog/colossal-ai-chatgpt)

## Online demo
You can experience the performance of Coati7B on this page.

[chat.colossalai.org](https://chat.colossalai.org/)

Due to resource constraints, we will only provide this service from 29th Mar 2023 to 5 April 2023. However, we have provided the inference code in the [inference](./inference/) folder. The WebUI will be open-sourced soon as well.

> Warning: Due to model and dataset size limitations, Coati is just a baby model, Coati7B may output incorrect information and lack the ability for multi-turn dialogue. There is still significant room for improvement.
## Install

Expand All @@ -81,7 +98,7 @@ pip install .

### Supervised datasets collection

we colllected 104K bilingual dataset of Chinese and English, and you can find the datasets in this repo
we collected 104K bilingual datasets of Chinese and English, and you can find the datasets in this repo
[InstructionWild](https://github.com/XueFuzhao/InstructionWild)

Here is how we collected the data
Expand Down Expand Up @@ -171,25 +188,25 @@ if not USE_8BIT:
model.eval()
```

**Troubleshooting**: if you get error indicating your CUDA-related libraries not found when loading 8-bit model, you can check whether your `LD_LIBRARY_PATH` is correct.
**Troubleshooting**: if you get errors indicating your CUDA-related libraries are not found when loading the 8-bit model, you can check whether your `LD_LIBRARY_PATH` is correct.

E.g. you can set `export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH`.

#### 4-bit setup

Please ensure you have downloaded HF-format model weights of LLaMA models first.
Please ensure you have downloaded the HF-format model weights of LLaMA models first.

Then you can follow [GPTQ-for-LLaMa](https://github.com/qwopqwop200/GPTQ-for-LLaMa). This lib provides efficient CUDA kernels and weight convertion script.
Then you can follow [GPTQ-for-LLaMa](https://github.com/qwopqwop200/GPTQ-for-LLaMa). This lib provides efficient CUDA kernels and weight conversion scripts.

After installing this lib, we may convert the original HF-format LLaMA model weights to 4-bit version.
After installing this lib, we may convert the original HF-format LLaMA model weights to a 4-bit version.

```shell
CUDA_VISIBLE_DEVICES=0 python llama.py /path/to/pretrained/llama-7b c4 --wbits 4 --groupsize 128 --save llama7b-4bit.pt
```

Run this command in your cloned `GPTQ-for-LLaMa` directory, then you will get a 4-bit weight file `llama7b-4bit-128g.pt`.

**Troubleshooting**: if you get error about `position_ids`, you can checkout to commit `50287c3b9ae4a3b66f6b5127c643ec39b769b155`(`GPTQ-for-LLaMa` repo).
**Troubleshooting**: if you get errors about `position_ids`, you can checkout to commit `50287c3b9ae4a3b66f6b5127c643ec39b769b155`(`GPTQ-for-LLaMa` repo).

For more details, see [`inference/`](https://github.com/hpcaitech/ColossalAI/tree/main/applications/Chat/inference).

Expand Down Expand Up @@ -263,7 +280,7 @@ For more details, see [`inference/`](https://github.com/hpcaitech/ColossalAI/tre

</details>

You can find more examples in this [repo](https://github.com/XueFuzhao/InstructionWild/blob/main/compare.md).
You can find more examples in this [repo](https://github.com/XueFuzhao/InstructionWild/blob/main/comparison.md).

### Limitation for LLaMA-finetuned models
- Both Alpaca and ColossalChat are based on LLaMA. It is hard to compensate for the missing knowledge in the pre-training stage.
Expand Down Expand Up @@ -317,7 +334,7 @@ trainer.save_model(path=args.save_path, only_rank0=True, tokenizer=tokenizer)
- [x] implement PPO-ptx fine-tuning
- [ ] integrate with Ray
- [ ] support more RL paradigms, like Implicit Language Q-Learning (ILQL),
- [ ] support chain of throught by [langchain](https://github.com/hwchase17/langchain)
- [ ] support chain-of-thought by [langchain](https://github.com/hwchase17/langchain)

### Real-time progress
You will find our progress in github project broad
Expand Down Expand Up @@ -360,9 +377,16 @@ Thanks so much to all of our amazing contributors!

## Authors

Coati is developed by ColossalAI Team: [Fazzie](https://fazzie-key.cool/about/index.html), [FrankLeeeee](https://github.com/FrankLeeeee), [BlueRum](https://github.com/ht-zhou), [ver217](https://github.com/ver217)
Coati is developed by ColossalAI Team:
- [Fazzie](https://fazzie-key.cool/about/index.html)
- [FrankLeeeee](https://github.com/FrankLeeeee)
- [BlueRum](https://github.com/ht-zhou)
- [ver217](https://github.com/ver217)
- [ofey404](https://github.com/ofey404)

The Phd student [Zangwei Zheng](https://github.com/zhengzangw) and [Xue Fuzhao](https://github.com/XueFuzhao) also contributed a lot to this project.
The Phd student from [(HPC-AI) Lab](https://ai.comp.nus.edu.sg/) also contributed a lot to this project.
- [Zangwei Zheng](https://github.com/zhengzangw)
- [Xue Fuzhao](https://github.com/XueFuzhao)

## Citations

Expand Down
1 change: 1 addition & 0 deletions applications/Chat/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ torchrun --standalone --nproc_per_node=4 train_prompts.py \
- --strategy: the strategy using for training, choices=['naive', 'ddp', 'colossalai_gemini', 'colossalai_zero2'], default='naive'
- --model: model type of actor, choices=['gpt2', 'bloom', 'opt', 'llama'], default='bloom'
- --pretrain: pretrain model, type=str, default=None
- --rm_model: reward model type, type=str, choices=['gpt2', 'bloom', 'opt', 'llama'], default=None
- --rm_pretrain: pretrain model for reward model, type=str, default=None
- --rm_path: the path of rm model, type=str, default=None
- --save_path: path to save the model, type=str, default='output'
Expand Down
Loading