Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
GLM-4_pytorch
Commits
f6f5b435
Commit
f6f5b435
authored
Apr 23, 2025
by
chenych
Browse files
Fix bugs
parent
dbcc8b8d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
5 deletions
+14
-5
README.md
README.md
+11
-3
finetune/configs/lora.yaml
finetune/configs/lora.yaml
+1
-1
finetune/configs/sft.yaml
finetune/configs/sft.yaml
+1
-1
finetune/requirements.txt
finetune/requirements.txt
+1
-0
No files found.
README.md
View file @
f6f5b435
...
@@ -163,7 +163,7 @@ cd finetune
...
@@ -163,7 +163,7 @@ cd finetune
```
```
2.
配置文件位于
[
configs
](
./finetune/configs/
)
目录下,包括以下文件:
2.
配置文件位于
[
configs
](
./finetune/configs/
)
目录下,包括以下文件:
-
`deepspeed配置文件`
:
[
ds_zer
e
o_2
](
./finetune/configs/ds_zer
e
o_2.json
)
,
[
ds_zer
e
o_3
](
./finetune/configs/ds_zer
e
o_3.json
)
-
`deepspeed配置文件`
:
[
ds_zero_2
](
./finetune/configs/ds_zero_2.json
)
,
[
ds_zero_3
](
./finetune/configs/ds_zero_3.json
)
-
`lora.yaml/ sft.yaml`
: 模型不同方式的配置文件,包括模型参数、优化器参数、训练参数等。部分重要参数解释如下:
-
`lora.yaml/ sft.yaml`
: 模型不同方式的配置文件,包括模型参数、优化器参数、训练参数等。部分重要参数解释如下:
+
data_config 部分
+
data_config 部分
+
train_file: 训练数据集的文件路径。
+
train_file: 训练数据集的文件路径。
...
@@ -202,16 +202,24 @@ cd finetune
...
@@ -202,16 +202,24 @@ cd finetune
+
token_dim: 256: P-TuningV2 的 token 维度(不要改动)。
+
token_dim: 256: P-TuningV2 的 token 维度(不要改动)。
#### 单机单卡
#### 单机单卡
> 注意:此方法不支持全参微调
```
shell
```
shell
# For Chat Fine-tune
# For Chat Fine-tune
python finetune.py data/AdvertiseGen/ THUDM/GLM-4-9B-0414 configs/lora.yaml
export
HIP_VISIBLE_DEVICES
=
1
# 可自行修改为指定显卡号
export
HSA_FORCE_FINE_GRAIN_PCIE
=
1
python finetune.py ../data/AdvertiseGen/saves/ THUDM/GLM-4-9B-0414 configs/lora.yaml
```
```
#### 单机多卡/多机多卡
#### 单机多卡/多机多卡
这里使用
`deepspeed`
作为加速方案,请确认当前环境已经根据
[
环境配置章节
](
#环境配置
)
安装好了
`deepspeed`
库。
这里使用
`deepspeed`
作为加速方案,请确认当前环境已经根据
[
环境配置章节
](
#环境配置
)
安装好了
`deepspeed`
库。
```
shell
```
shell
# For Chat Fine-tune
# For Chat Fine-tune
OMP_NUM_THREADS
=
1 torchrun
--standalone
--nnodes
=
1
--nproc_per_node
=
8 finetune.py data/AdvertiseGen/ THUDM/GLM-4-9B-0414 configs/lora.yaml
# For Chat Fine-tune
export
HIP_VISIBLE_DEVICES
=
0,1,2,3,4,5,6,7
# 可自行修改为指定显卡号
export
HSA_FORCE_FINE_GRAIN_PCIE
=
1
OMP_NUM_THREADS
=
1 torchrun
--standalone
--nnodes
=
1
--nproc_per_node
=
8 finetune.py ../data/AdvertiseGen/saves THUDM/GLM-4-9B-0414 configs/lora.yaml
# For Chat Fine-tune
```
```
#### 从保存点进行微调
#### 从保存点进行微调
...
...
finetune/configs/lora.yaml
View file @
f6f5b435
...
@@ -8,7 +8,7 @@ combine: True
...
@@ -8,7 +8,7 @@ combine: True
freezeV
:
True
freezeV
:
True
max_input_length
:
512
max_input_length
:
512
max_output_length
:
512
max_output_length
:
512
#
swanlab: "local" # set to local if don`t use cloud
swanlab
:
"
local"
# set to local if don`t use cloud
training_args
:
training_args
:
# see `transformers.Seq2SeqTrainingArguments`
# see `transformers.Seq2SeqTrainingArguments`
...
...
finetune/configs/sft.yaml
View file @
f6f5b435
...
@@ -8,7 +8,7 @@ combine: True
...
@@ -8,7 +8,7 @@ combine: True
freezeV
:
True
freezeV
:
True
max_input_length
:
512
max_input_length
:
512
max_output_length
:
512
max_output_length
:
512
#
swanlab: "local" # set to local if don`t use cloud
swanlab
:
"
local"
# set to local if don`t use cloud
training_args
:
training_args
:
# see `transformers.Seq2SeqTrainingArguments`
# see `transformers.Seq2SeqTrainingArguments`
...
...
finetune/requirements.txt
View file @
f6f5b435
...
@@ -6,3 +6,4 @@ rouge_chinese==1.0.3
...
@@ -6,3 +6,4 @@ rouge_chinese==1.0.3
ruamel.yaml>=0.18.6
ruamel.yaml>=0.18.6
typer>=0.13.0
typer>=0.13.0
tqdm>=4.67.0
tqdm>=4.67.0
mpi4py
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment