Commit 93e23758 authored by zhaoying1's avatar zhaoying1
Browse files

update

parent bb422554
...@@ -41,7 +41,7 @@ docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.13.1-centos7.6-dtk ...@@ -41,7 +41,7 @@ docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.13.1-centos7.6-dtk
``` ```
docker run -dit --network=host --name=chatglm3 --privileged --device=/dev/kfd --device=/dev/dri --ipc=host --shm-size=16G --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -u root --ulimit stack=-1:-1 --ulimit memlock=-1:-1 image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.13.1-centos7.6-dtk-23.04-py38-latest docker run -dit --network=host --name=chatglm3 --privileged --device=/dev/kfd --device=/dev/dri --ipc=host --shm-size=16G --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -u root --ulimit stack=-1:-1 --ulimit memlock=-1:-1 image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.13.1-centos7.6-dtk-23.04-py38-latest
docker exec -it chatglm3 /bin/bash docker exec -it chatglm3 /bin/bash
pip install -4 requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
``` ```
### Dockerfile(方式二) ### Dockerfile(方式二)
``` ```
...@@ -69,7 +69,7 @@ pip install -r requirements.txt ...@@ -69,7 +69,7 @@ pip install -r requirements.txt
``` ```
## 数据集 ## 数据集
本仓库以 [ADGEN](https://aclanthology.org/D19-1321.pdf) (广告生成) 数据集为例介绍代码的使用方法,该数据集任务为根据输入(content)生成一段广告词(summary),以下为下载地址: 单轮对话数据以[ADGEN](https://aclanthology.org/D19-1321.pdf) (广告生成) 数据集为例介绍代码的使用方法,该数据集任务为根据输入(content)生成一段广告词(summary),以下为下载地址:
- [Google Drive](https://drive.google.com/file/d/13_vf0xRTQsyneRKdD1bZIr93vBGOczrk/view?usp=sharing) 或者 [Tsinghua Cloud](https://cloud.tsinghua.edu.cn/f/b3f119a008264b1cabd1/?dl=1) - [Google Drive](https://drive.google.com/file/d/13_vf0xRTQsyneRKdD1bZIr93vBGOczrk/view?usp=sharing) 或者 [Tsinghua Cloud](https://cloud.tsinghua.edu.cn/f/b3f119a008264b1cabd1/?dl=1)
下载处理好的 ADGEN 数据集,将解压后的AdvertiseGen目录放到 [finetune_chatmodel_demo](./finetune_chatmodel_demo)目录下。数据集目录结构如下: 下载处理好的 ADGEN 数据集,将解压后的AdvertiseGen目录放到 [finetune_chatmodel_demo](./finetune_chatmodel_demo)目录下。数据集目录结构如下:
``` ```
...@@ -83,6 +83,14 @@ cd finetune_chatmodel_demo ...@@ -83,6 +83,14 @@ cd finetune_chatmodel_demo
python ./scripts/format_advertise_gen.py --path "AdvertiseGen/train.json" python ./scripts/format_advertise_gen.py --path "AdvertiseGen/train.json"
``` ```
多轮对话及工具调用数据以[ToolAlpaca](https://github.com/tangqiaoyu/ToolAlpaca)数据集为例介绍代码的使用方法,下载数据集,并通过以下方式将数据集处理成模型需要的格式:
```bash
cd finetune_chatmodel_demo
python ./scripts/format_tool_alpaca.py --path "train_data.json"
```
### 模型下载 ### 模型下载
| Model | Seq Length | Download | Model | Seq Length | Download
| :---: |:---------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------: | :---: |:---------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------:
...@@ -95,23 +103,35 @@ python ./scripts/format_advertise_gen.py --path "AdvertiseGen/train.json" ...@@ -95,23 +103,35 @@ python ./scripts/format_advertise_gen.py --path "AdvertiseGen/train.json"
### P-tuning v2 微调训练 ### P-tuning v2 微调训练
本仓库实现了对于ChatGLM3-6B模型基于[P-Tuning v2](https://github.com/THUDM/P-tuning-v2)的微调。P-Tuning v2是由清华大学提出的一种高效参数微调方法。 本仓库实现了对于ChatGLM3-6B模型基于[P-Tuning v2](https://github.com/THUDM/P-tuning-v2)的微调。P-Tuning v2是由清华大学提出的一种高效参数微调方法。
#### 单机多卡训练 #### 单轮对话微调
``` ```
cd ./finetune_chatmodel_demo/scripts cd ./finetune_chatmodel_demo/scripts
bash finetune_pt.sh bash finetune_pt.sh
``` ```
注意:请根据自己的需求配置其中的模型路径、数据集路径、batchsize、学习率等参数; 注意:请根据自己的需求配置其中的模型路径、数据集路径、batchsize、学习率等参数;
#### 多轮对话及工具能力微调
```
cd ./finetune_chatmodel_demo/scripts
bash finetune_pt_multiturn.sh
```
注意:请根据自己的需求配置其中的模型路径、数据集路径、batchsize、学习率等参数;
### Finetune全参数微调 ### 全参数微调
#### 单机多卡训练 #### 单轮对话微调
``` ```
cd ./finetune_chatmodel_demo/scripts cd ./finetune_chatmodel_demo/scripts
bash finetune_ds.sh bash finetune_ds.sh
``` ```
注意:请根据自己的需求配置其中的模型路径、数据集路径、batchsize、学习率等参数; 注意:请根据自己的需求配置其中的模型路径、数据集路径、batchsize、学习率等参数;
#### 多轮对话及工具能力微调
```
cd ./finetune_chatmodel_demo/scripts
bash finetune_ds_multiturn.sh
```
注意:请根据自己的需求配置其中的模型路径、数据集路径、batchsize、学习率等参数;
### 推理验证 ### 推理验证
对于输入输出格式的微调,可使用 `inference.py` 进行基本的推理验证。 对于输入输出格式的微调,可使用 `inference.py` 进行基本的推理验证。
...@@ -163,5 +183,5 @@ python inference.py \ ...@@ -163,5 +183,5 @@ python inference.py \
## 参考 ## 参考
- [THUDM/ChatGLM3-6B](https://github.com/THUDM/ChatGLM3) - [THUDM/ChatGLM3-6B](https://github.com/THUDM/ChatGLM3/tree/main)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment