18 Star 75 Fork 49

DeepSpark / DeepSparkHub

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 1.92 KB
一键复制 编辑 原始数据 按行查看 历史
majorli6 提交于 2024-03-25 15:56 . unify Llama 2 name to be official name

Megatron-DeepSpeed Llama-2-7B SFT

Model description

Llama 2 is a large language model released by Meta in 2023, with parameters ranging from 7B to 70B. Compared to LLaMA, the training corpus of Llama 2 is 40% longer, and the context length has been upgraded from 2048 to 4096, allowing for understanding and generating longer texts.

Step 1: Installation

# Install sqlite3
wget https://sqlite.org/2019/sqlite-autoconf-3290000.tar.gz
tar zxvf sqlite-autoconf-3290000.tar.gz
pushd sqlite-autoconf-3290000
./configure
make && make install
popd

# Reinstall Python
wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tar.xz
tar xvf Python-3.7.9.tar.xz
pushd Python-3.7.9
./configure LDFLAGS="-L/usr/local/lib" CPPFLAGS="-I/usr/local/include" --prefix=/usr/bin
make && make install

cp /usr/bin/lib/python3.7/lib-dynload/_sqlite3.cpython-37m-x86_64-linux-gnu.so /usr/local/lib/python3.7/lib-dynload/_sqlite3.so
popd

# Install Megatron-Deepspeed
bash build_megatron-deepspeed.sh && bash install_megatron-deepspeed.sh

Step 2: Preparing datasets

cd dataset/
bash download_and_convert_dataset.sh

Step 3: Download and convert HF weight

You can download huggingface llama2-7b pretrained model from here, and use below script to convert it.

cd checkpoints
bash convert_hf_2_meg.sh

Step 4: Training

cd examples/llama2
bash run_meg_llama2_7b_sft.sh

If the torchrun command cannot be found,you can execute:

ln -s /usr/local/corex-3.1.0/lib64/python3/dist-packages/bin/torchrun /usr/local/bin/

Results

GPUs Toolbox Model Training speed
BI-V100 x8 Megatron-DeepSpeed LLaMA2-7B SFT 1.146 samples/sec

Reference

Python
1
https://gitee.com/deep-spark/deepsparkhub.git
git@gitee.com:deep-spark/deepsparkhub.git
deep-spark
deepsparkhub
DeepSparkHub
master

搜索帮助