Giter VIP home page Giter VIP logo

gpt-from-zero's Introduction

gpt-from-zero

this repo records how i train a gpt-style model from scratch

phase1: pretrain

step1: data preparation

python pre_tokenization.py --train_dir train/zh --valid_dir val/zh --output_path cached/zh --num_files 100 --n_jobs 12 --dataset

step2: train the pt model

deepspeed --include localhost:0,1 pretrain_ds.py --exp_name gpt_1B --output_dir gpt_1B --zero_stage 2 --config_path configs/1B.json --gradient_checkpointing --per_device_train_batch_size 72 --bf16 --offload

phase2: supervised-finetuning

step1: data preparation

python pre_tokenization.py --task sft --train_filename sft-data/alpaca_chinese_train.json --valid_filename sft-data/alpaca_chinese_train.json --output_path cached/sft

step2: train the sft model

deepspeed --include localhost:0 pretrain_ds.py --task sft --exp_name gpt_1B_sft --output_dir gpt_1B_sft --zero_stage 0 --config_path configs/1B.json --gradient_checkpointing --per_device_train_batch_size 24 --model_path gpt_1B/pretrain_steps_3000 --eval_steps 300 --save_steps 300 --epochs 3 --lr 3e-5 --bf16

phase3: DPO/ORPO

step1: data preparation

python pre_tokenization.py --task dpo --train_filename dpo-data/alpaca_chinese_train.json --valid_filename dpo-data/alpaca_chinese_train.json --output_path cached/dpo

step2: train the dpo/ocpo model

deepspeed --include localhost:5,6 --master_port 29600 pretrain_ds.py --task orpo --exp_name gpt_1B_orpo --output_dir gpt_1B_orpo --zero_stage 2 --config_path configs/1B.json --gradient_checkpointing --per_device_train_batch_size 18 --model_path gpt_1B/pretrain_steps_20000 --eval_steps 1000 --save_steps 1000 --epochs 3 --lr 1e-5 --bf16

gpt-from-zero's People

Contributors

jy1993 avatar

Stargazers

 avatar

Watchers

 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.