Giter Club home page Giter Club logo

chatglm_lora_multi-gpu's Introduction

Chatglm_lora_multi-gpu

chatglm多gpu用deepspeed和

大模型prompt&delta理论部分知识

1.CSDN链接

2.知乎链接

迭代比较匆忙,空了我会重新整理

初始化环境

pip install -r requirements.txt

包括两种方式多gpu运行:

1.deepspeed

数据处理

给两份belle中文的self instruct数据
     1.0.5M版本:
      cd data 
      
      wget https://huggingface.co/datasets/BelleGroup/generated_train_0.5M_CN/resolve/main/Belle.train.json

     2.1M版本
     
     wget https://huggingface.co/datasets/BelleGroup/generated_train_1M_CN/resolve/main/belle_open_source_1M.train.json

     3.把两份数据合并成一份

     a.0.5M和1M数据字段有些不同,统一处理数据,用地下代码处理1M数据
     
     cd ..
     
     python process_belle_1M_data.py

     b.把两份文件合并成一份,命名为:Belle_0_1.train.json

     cd data & cat Belle.train.json Belle_1M.train.json>Belle_0_1.train.json

数据准备好后执行下面命令

torchrun --nproc_per_node=2 multi_gpu_fintune_belle.py \ --dataset_path data/alpaca \ --lora_rank 8 \ --per_device_train_batch_size 1 \ --gradient_accumulation_steps 1 \ --save_steps 1000 \ --save_total_limit 2 \ --learning_rate 2e-5 \ --fp16 \ --num_train_epochs 2 \ --remove_unused_columns false \ --logging_steps 50 \ --gradient_accumulation_steps 2 \ --output_dir output \ --deepspeed ds_config_zero3.json

2.accelerate+deepspeed

准备数据

下载数据

cd data

wget https://huggingface.co/datasets/BelleGroup/generated_train_0.5M_CN/resolve/main/Belle.train.json

python tokenize_dataset_rows_belle.py
--jsonl_path data/alpaca_data.jsonl
--save_path data/alpaca
--max_seq_length 200
--skip_overlength

数据准备好后执行下面命令

accelerate launch --config_file accelerate_ds_zero3_cpu_offload_config.yaml multi_gpu_fintune_belle.py \ --dataset_path data/alpaca \ --lora_rank 8 \ --per_device_train_batch_size 2 \ --gradient_accumulation_steps 1 \ --max_steps 10000 \ --save_steps 1000 \ --save_total_limit 2 \ --learning_rate 2e-5 \ --fp16 \ --remove_unused_columns false \ --logging_steps 50 \ --output_dir output

3.ddp方式还没试

chatglm_lora_multi-gpu's People

Contributors

liangwq avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.