Skip to content

Commit

Permalink
fixed docs
Browse files Browse the repository at this point in the history
Signed-off-by: ftgreat <[email protected]>
  • Loading branch information
ftgreat committed Jun 12, 2023
1 parent 60af0d6 commit 3ebde48
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 19 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,16 @@ git clone https://github.com/OpenBMB/BMTrain
cd BMTrain
python setup.py install
```
- [Tips] For single-node docker environments, we need to set up ports for your ssh. e.g., [email protected] with port 7110
- [Optional] For BMInf low-resource inference, install [BMInf](https://github.com/OpenBMB/BMInf)
```
>>> vim ~/.ssh/config
Host 127.0.0.1
Hostname 127.0.0.1
Port 7110
User root
pip install bminf
```
- [Optional] For Flash Attention, install [Flash-attention](https://github.com/HazyResearch/flash-attention)
```
pip install flash-attn
```

- [Tips] For multi-node docker environments, generate ssh keys and copy the public key to all nodes (in `~/.ssh/`)
```
>>> ssh-keygen -t rsa -C "[email protected]"
Expand Down
11 changes: 11 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,17 @@ git clone https://github.com/OpenBMB/BMTrain
cd BMTrain
python setup.py install
```

- [可选] 开启BMInf低资源推理, 需要安装[BMInf](https://github.com/OpenBMB/BMInf)
```
pip install bminf
```
- [可选] 对于FlashAttention, 需要安装[Flash-attention](https://github.com/HazyResearch/flash-attention)
```
pip install flash-attn
```

- [可选] 镜像构建,请参照 [Dockerfile](https://github.com/FlagAI-Open/FlagAI/blob/master/Dockerfile)
- [提示] 单节点docker环境下,运行多卡数据并行需要设置host。 例如,docker节点 [email protected],其端口 7110。
```
Expand Down
15 changes: 10 additions & 5 deletions examples/Aquila/Aquila-chat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ The tokenizer used in the Aquila model was trained from scratch by us and suppor
| LLaMA | 32000 | sp(bpe)|1805| 1257|1970 |
| Aquila | 100000 | bpe|1575 | 477|1679 |

Aquila系列模型均可在24G显卡上运行。

The Aquila series models can all run on a 24GB graphics card.

## 训练数据集/Training data

Expand All @@ -61,6 +64,8 @@ We have added support for two additional multimodal instructions: text-to-image

### 1. 推理/Inference

运行成功后模型会自动下载在`./checkpoints_in`里,

```python
import os
import torch
Expand All @@ -71,7 +76,7 @@ from flagai.data.tokenizer import Tokenizer
import bminf

state_dict = "./checkpoints_in"
model_name = 'aquilachat-33b'
model_name = 'aquilachat-7b'

loader = AutoLoader(
"lm",
Expand Down Expand Up @@ -174,10 +179,10 @@ with torch.no_grad():
Create a new directory named `aquilachat-7b` inside `./checkpoints_in`. Place the fine-tuned checkpoint and all other files from the original `aquilachat-7b` model, including `config.json`, `mergex.txt`, `vocab.json`, and `special_tokens_map.json`, into this directory.

#### Step 2: 修改参数/ Modify Parameters
* `cd /examples/Aquila/Aquila-sft`
* `cd /examples/Aquila/Aquila-chat`
* 配置`hostfile`文件, 参考[这里](../../../doc_zh/TUTORIAL_8_ENVIRONMENT_SETUP.md#a配置hostfilehostfile-中的v100-1-与sshconfig-对应) ; Configure the `hostfile` file, refer to [here](../../../docs/TUTORIAL_8_ENVIRONMENT_SETUP.md)
* 配置`bmtrain_mgpu.sh`文件, 将`SCRIPT_FILE`改成`aquila_sft.py`; configure the `bmtrain_mgpu.sh` file, change `SCRIPT_FILE` to `aquila_sft.py`
* (可选) 在`Aquila-sft.yaml`文件里更改参数 ; (optional) change parameters in `Aquila-sft.yaml`
* 配置`bmtrain_mgpu.sh`文件, 将`SCRIPT_FILE`改成`aquila_chat.py`; configure the `bmtrain_mgpu.sh` file, change `SCRIPT_FILE` to `aquila_chat.py`
* (可选) 在`Aquila-chat.yaml`文件里更改参数 ; (optional) change parameters in `Aquila-chat.yaml`

| 参数名 Parameter | 类型 Type | 描述 Description |
|--------------------------------|------------|-------------------------------------------------------|
Expand All @@ -195,7 +200,7 @@ Create a new directory named `aquilachat-7b` inside `./checkpoints_in`. Place th

#### Step 3: 启动可监督微调/Start SFT
```
bash dist_trigger_docker.sh hostfile Aquila-sft.yaml aquilachat-7b [实验名]
bash dist_trigger_docker.sh hostfile Aquila-chat.yaml aquilachat-7b [实验名]
```
接下来会输出下列信息,注意`NODES_NUM`应该与节点数相等,`LOGFILE`是模型运行的日志文件;The following information will be output. Note that `NODES_NUM` should be equal to the number of nodes, and `LOGFILE` is the log file for the model run.

Expand Down
3 changes: 3 additions & 0 deletions examples/Aquila/Aquila-code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ We used different tokenizers to extract ten thousand data samples from English,
| LLaMA | 32000 | sp(bpe)|1805| 1257|1970 |
| Aquila | 100000 | bpe|1575 | 477|1679 |

Aquila系列模型均可在24G显卡上运行。

The Aquila series models can all run on a 24GB graphics card.

## 训练数据集/Training data
`AquilaCode-7B-NV``AquilaCode-7B-TS`模型训练使用了[starcoderdata](https://huggingface.co/datasets/bigcode/starcoderdata)中的shell, sql,C, C++, Java, Javascript, Python, git-commits, github-issues, jupyter-scripts, jupyter-structured-text数据
Expand Down
1 change: 1 addition & 0 deletions examples/Aquila/Aquila-code/generate_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import torch
import os
from flagai import mpu
import sys;sys.path.append("/data2/yzd/workspace/FlagAI")
from flagai.auto_model.auto_loader import AutoLoader
import random
import numpy as np
Expand Down
11 changes: 7 additions & 4 deletions examples/Aquila/Aquila-pretrain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ The tokenizer used in the Aquila model was trained from scratch by us and suppor
| LLaMA | 32000 | sp(bpe)|1805| 1257|1970 |
| Aquila | 100000 | bpe|1575 | 477|1679 |

Aquila系列模型均可在24G显卡上运行。

The Aquila series models can all run on a 24GB graphics card.


## 训练数据集/Training data
Aquila预训练使用了Pile,[RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T), [Wikipedia](https://huggingface.co/datasets/wikipedia), [C4](https://huggingface.co/datasets/c4), 悟道中文数据集、电子书、专利、百科、论坛, github数据等, 详情可见下图。

The Aquila-7B model was pretrained on Pile,[RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T), [Wikipedia](https://huggingface.co/datasets/wikipedia), [C4](https://huggingface.co/datasets/c4), Wudao Corpus、e-book、Patent, encyclopedia, forum, github etc. Details are given in the figure below.

![Screenshot](../img/data_dist.png)
<!-- ![Screenshot](../img/data_dist.png) -->



Expand Down Expand Up @@ -97,15 +100,15 @@ bash dist_trigger_docker.sh hostfile Aquila-pretrain-33B.yaml aquila-33b [实验

#### Step 2: 启动可监督微调/Start SFT
```
cd ../Aquila-sft/
cd ../Aquila-chat/
```
对于Aquila-7B模型:
```
bash dist_trigger_docker.sh hostfile Aquila-sft.yaml aquila-7b [实验名 experiment name]
bash dist_trigger_docker.sh hostfile Aquila-chat.yaml aquila-7b [实验名 experiment name]
```
对于Aquila-33B模型:
```
bash dist_trigger_docker.sh hostfile Aquila-sft.yaml aquila-33b [实验名 experiment name]
bash dist_trigger_docker.sh hostfile Aquila-chat.yaml aquila-33b [实验名 experiment name]
```
接下来会输出下列信息,注意`NODES_NUM`应该与节点数相等,`LOGFILE`是模型运行的日志文件;The following information will be output. Note that `NODES_NUM` should be equal to the number of nodes, and `LOGFILE` is the log file for the model run.

Expand Down
10 changes: 6 additions & 4 deletions examples/Aquila/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ The tokenizer used in the Aquila model was trained from scratch by us and suppor
| LLaMA | 32000 | sp(bpe)|1805| 1257|1970 |
| Aquila | 100000 | bpe|1575 | 477|1679 |

Aquila系列模型均可在24G显卡上运行。

The Aquila series models can all run on a 24GB graphics card.

## 训练数据集/Training data
Aquila预训练使用了Pile,[RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T), [Wikipedia](https://huggingface.co/datasets/wikipedia), [C4](https://huggingface.co/datasets/c4), 悟道中文数据集、电子书、专利、百科、论坛, github数据等, 详情可见下图。

The Aquila-7B model was pretrained on Pile,[RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T), [Wikipedia](https://huggingface.co/datasets/wikipedia), [C4](https://huggingface.co/datasets/c4), Wudao Corpus、e-book、Patent, encyclopedia, forum, github etc. Details are given in the figure below.

![Screenshot](./img/data_dist.png)
<!-- ![Screenshot](./img/data_dist.png) -->



Expand Down Expand Up @@ -96,15 +98,15 @@ bash dist_trigger_docker.sh hostfile Aquila-pretrain-33B.yaml aquila-33b [实验

#### Step 2: 启动可监督微调/Start SFT
```
cd ../Aquila-sft/
cd ../Aquila-chat/
```
对于Aquila-7B模型:
```
bash dist_trigger_docker.sh hostfile Aquila-sft.yaml aquila-7b [实验名 experiment name]
bash dist_trigger_docker.sh hostfile Aquila-chat.yaml aquila-7b [实验名 experiment name]
```
对于Aquila-33B模型:
```
bash dist_trigger_docker.sh hostfile Aquila-sft.yaml aquila-33b [实验名 experiment name]
bash dist_trigger_docker.sh hostfile Aquila-chat.yaml aquila-33b [实验名 experiment name]
```
接下来会输出下列信息,注意`NODES_NUM`应该与节点数相等,`LOGFILE`是模型运行的日志文件;The following information will be output. Note that `NODES_NUM` should be equal to the number of nodes, and `LOGFILE` is the log file for the model run.

Expand Down

0 comments on commit 3ebde48

Please sign in to comment.