Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChatGLM #527

Merged
merged 15 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
39 changes: 39 additions & 0 deletions projects/ChatGLM/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# ChatGLM
Reproduce ChatGLM with OneFlow, which effect are equivalent to HuggingFace's [ChatGLM3](https://huggingface.co/THUDM/chatglm3-6b).

## Introduce
The ChatGLM Supervised FineTuning project can support 3D parallel.

## FineTuning ChatGLM3
FineTuning ChatGLM3 on 8 GPUs using parallelism.

### 1. Prepare the sft dataset
#### download dataset
```bash
export DATA_DIR=~/DATA # [At the beginning, it was an empty folder]
cd $DATA_DIR
git clone https://www.modelscope.cn/datasets/YorickHe/CoT_zh.git
```

#### preprocess
```bash
cd projects/ChatGLM
python utils/prepare_CoT_zh.py
```
### 2. Prepare your finetuning config file

> set the finetuning parameters in `projects/ChatGLM/configs/chatglm_sft.py`, such as `dataset_path` and `pretrained_model_path`.


### 3. Run the following code to start SFT
```bash
# cd /path/to/libai
bash tools/train.sh projects/ChatGLM/train_net.py projects/ChatGLM/configs/chatglm_sft.py 8
```

## ChatGLM Inference
- Prepare the ChatGLM checkpoint.
- Adjust the parameters in the `projects/ChatGLM/pipeline.py`, and running:
```bash
python projects/ChatGLM/pipeline.py
xiezipeng-ML marked this conversation as resolved.
Show resolved Hide resolved
```
Loading