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

Documentation: 4090 上运行 CodeGeeX 的步骤 #103

Open
davideuler opened this issue Mar 30, 2023 · 0 comments
Open

Documentation: 4090 上运行 CodeGeeX 的步骤 #103

davideuler opened this issue Mar 30, 2023 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@davideuler
Copy link

4090 因为显存不足,不能直接运行。 需要把 checkpoint 文件转换为 ft 版本。

前提条件:
已经下载好了 checkpoint 文件列表,并且合并后解压为 codegeex_13b.pt。

1.运行容器,进入到支持 GPU的 pytorch 环境,

git clone https://github.com/CodeGeeX/codegeex-fastertransformer
cd codegeex-fastertransformer
docker pull nvcr.io/nvidia/pytorch:21.11-py3
docker run -p 9114:5000 --cpus 28 --gpus all -it -v `pwd`:/workspace/codegeex-fastertransformer -v /data/workspace/:/data/workspace --ipc=host  --name=test nvcr.io/nvidia/pytorch:21.11-py3

如果启动容器时遇到这个错误: could not select device driver "" with capabilities: [[gpu]]

说明 nvidial 的驱动没有装好,需要在主机上安装驱动。 解决方法:
https://collabnix.com/introducing-new-docker-cli-api-support-for-nvidia-gpus-under-docker-engine-19-03-0-beta-release/

NVIDIA/nvidia-docker#1034

2.容器中运行脚本 make_all.sh 生成 ft 版本 checkpoint 文件

link make to gmake:

ln -s /usr/bin/make /usr/bin/gmake

pip3 install transformers -i https://mirror.baidu.com/pypi/simple
pip3 install sentencepiece -i https://mirror.baidu.com/pypi/simple
pip install fire -i https://mirror.baidu.com/pypi/simple
cd codegeex-fastertransformer
sh make_all.sh 

3.更新容器中 get_ckpt_ft.py 脚本里面的 pt 文件路径。运行脚本:

运行 python get_ckpt_ft.py 生成 ft 版本 ckpt.

4.容器中启动服务:

python3 api.py --data_type int8 --ckpt_path /data/workspace/CodeGeeX/codegeex_13b_ft.pt

5.运行测试:

python3 post.py

也可以更改 post.py, 从宿主机调用本机的 9114 端口来提交数据。

效果示例:
image

@Stanislas0 Stanislas0 added the documentation Improvements or additions to documentation label Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants