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

add finetune code for qwen2audio #61

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ generated_ids = model.generate(**inputs, max_length=256)
generated_ids = generated_ids[:, inputs.input_ids.size(1):]
response = processor.batch_decode(generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
```

#### Finetuning
We would like to thank the Hugging Face open-source community for their contributions, which have made it easy for us to implement model fine-tuning with Accelerate and DeepSpeed. We support both LoRA (Low-Rank Adaptation) and full-parameter fine-tuning, with the code provided by [Xiaoming Liu](https://github.com/Lollipop).

```bash
cd finetune && bash run.sh
```

#### 🤖 ModelScope
We strongly advise users especially those in mainland China to use ModelScope. `snapshot_download` can help you solve issues concerning downloading checkpoints.
## Demo
Expand Down
8 changes: 8 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,14 @@ generated_ids = model.generate(**inputs, max_length=256)
generated_ids = generated_ids[:, inputs.input_ids.size(1):]
response = processor.batch_decode(generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
```

#### Finetuning
感谢 Hugging Face 开源社区的贡献,使我们能够轻松地使用 Accelerate 和 DeepSpeed 实现模型微调(finetuning)。脚本支持 LoRA(低秩适应)和全参数微调,相关代码来自[Xiaoming Liu](https://github.com/Lollipop)。

```bash
cd finetune && bash run.sh
```

#### 🤖 ModelScope
我们强烈建议用户,特别是中国大陆地区的用户,使用 ModelScope。`snapshot_download` 可以帮助您解决下载检查点时遇到的问题。
<br>
Expand Down
24 changes: 24 additions & 0 deletions finetune/accelerate_configs/deepspeed_z1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
compute_environment: LOCAL_MACHINE
debug: false
deepspeed_config:
deepspeed_multinode_launcher: standard
gradient_accumulation_steps: 1
gradient_clipping: 1.0
zero3_init_flag: false
zero_stage: 1
distributed_type: DEEPSPEED
downcast_bf16: 'no'
enable_cpu_affinity: false
machine_rank: 0
main_process_ip: localhost
main_process_port: 9999
main_training_function: main
mixed_precision: bf16
num_machines: 2
num_processes: 16
rdzv_backend: static
same_network: true
tpu_env: []
tpu_use_cluster: false
tpu_use_sudo: false
use_cpu: false
26 changes: 26 additions & 0 deletions finetune/accelerate_configs/deepspeed_z2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
compute_environment: LOCAL_MACHINE
debug: false
deepspeed_config:
deepspeed_multinode_launcher: standard
gradient_accumulation_steps: 1
gradient_clipping: 1.0
offload_optimizer_device: none
offload_param_device: none
zero3_init_flag: false
zero_stage: 2
distributed_type: DEEPSPEED
downcast_bf16: 'no'
enable_cpu_affinity: false
machine_rank: 0
main_process_ip: localhost
main_process_port: 9999
main_training_function: main
mixed_precision: bf16
num_machines: 2
num_processes: 16
rdzv_backend: static
same_network: true
tpu_env: []
tpu_use_cluster: false
tpu_use_sudo: false
use_cpu: false
27 changes: 27 additions & 0 deletions finetune/accelerate_configs/deepspeed_z3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
compute_environment: LOCAL_MACHINE
debug: false
deepspeed_config:
deepspeed_multinode_launcher: standard
gradient_accumulation_steps: 1
gradient_clipping: 1.0
offload_optimizer_device: cpu
offload_param_device: cpu
zero3_init_flag: true
zero3_save_16bit_model: false
zero_stage: 3
distributed_type: DEEPSPEED
downcast_bf16: 'no'
enable_cpu_affinity: false
machine_rank: 0
main_process_ip: localhost
main_process_port: 999
main_training_function: main
mixed_precision: bf16
num_machines: 1
num_processes: 8
rdzv_backend: static
same_network: true
tpu_env: []
tpu_use_cluster: false
tpu_use_sudo: false
use_cpu: false
Loading