首先安装官方提供镜像

# Pull the latest image
docker pull zhuzilin/slime:latest
 
# start the docker
docker run -d -it --network=host --gpus all --privileged  --ipc=host --shm-size=16g   --ulimit memlock=-1 --ulimit stack=67108864  -v /model/:/workspace/infrawaves/  --name
 slime f01f4f265d5d  /bin/bash 

安装slime源码

git clone <https://github.com/THUDM/slime.git>
cd slime
pip install -e .

download模型与数据集、验证集

export HF_HUB_ENABLE_HF_TRANSFER=1
export HF_ENDPOINT=https://hf-mirror.com
 
# Download model weights (GLM-Z1-9B)
hf download zai-org/GLM-Z1-9B-0414 --local-dir /root/GLM-Z1-9B-0414
 
# Download training dataset (dapo-math-17k)
hf download --repo-type dataset zhuzilin/dapo-math-17k \\
  --local-dir /root/dapo-math-17k
 
# Download evaluation dataset (aime-2024)
hf download --repo-type dataset zhuzilin/aime-2024 \\
  --local-dir /root/aime-2024

转换hugging face权重为megatron格式

PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \\
    ${MODEL_ARGS[@]} \\
    --hf-checkpoint /root/GLM-Z1-9B-0414 \\
    --save /root/GLM-Z1-9B-0414_torch_dist

启动脚本

cd /root/slime
bash scripts/run-glm4-9B.sh

观察到会有如下的输出

image.png

其中,核心的perf信息如下:

image.png

image.png