在Jetson AGX Orin上复现FastChat
【摘要】 在Jetson AGX Orin上复现FastChat
参考

步骤,我们来一一复现。
首先我们有了一个Jetson Orin的Jetpack 5.1.1的环境,这个环境来自于:https://bbs.huaweicloud.com/blogs/407756
我们在这个环境上,创建一个conda python3.8的环境:

进入conda环境后,执行
pip3 install fschat


这里装了一堆软件包,看的有点吓人。
cd /home1/zhanghui
git clone https://github.com/lm-sys/FastChat.git
cd FastChat
mkdir -p models/vicuna-7b-v1.3

打开链接 https://huggingface.co/lmsys/vicuna-7b-v1.3/tree/main

下载相关的json文件,bin文件和model文件到 models/vicuna-7b-v1.3 目录:

cd ../..
执行 python -m fastchat.serve.cli --model-path models/vicuna-7b-v1.3



报错了:AssertionError: Torch not compiled with CUDA enabled
看来是conda环境中CUDA版本的问题。
难道不能用conda试验吗?
退出conda环境:

查看 Python版本为3.8

只好再重装一下:
pip install fschat


根据提示,将PATH中加入 ~/.local/bin
export PATH=$PATH:~/.local/bin
source ~/.bashrc
conda deactivate

cd /home1/zhanghui/FastChat
重新执行:
python3 -m fastchat.serve.cli --model-path models/vicuna-7b-v1.3
一样的错。。。


额,有点无能为力了。
检查下Pytorch 的版本:

确实装的不是带CUDA的Pytorch 2.0.1版本。
到底怎么才能装上带CUDA的Pytorch呢?
经过咨询GPUS Lady,知道他们成功运行的版本是:
Python 3.8
CUDA 11.4.315
Pytorch 1.14+nv23.01
查看 https://zhuanlan.zhihu.com/p/632052753 文档中 《(三)pytorch及torchvision安装》这一章节的内容,得知需要到 https://forums.developer.nvidia.com/t/pytorch-for-jetson/72048
查找JetPack对应的版本:

具体链接为:
https://developer.download.nvidia.com/compute/redist/jp/v51/pytorch/torch-1.14.0a0+44dac51c.nv23.02-cp38-cp38-linux_aarch64.whl
(这里是1.14+nv23.02,版本差不多,想必可以用。。)
我们在Orin的终端上wget一下:
wget https://developer.download.nvidia.com/compute/redist/jp/v51/pytorch/torch-1.14.0a0+44dac51c.nv23.02-cp38-cp38-linux_aarch64.whl

耐心等待下载完毕:

执行安装:(想想看还是进入conda环境来做吧)
source ~/.bashrc
conda activate fastchat8
pip install ./torch-1.14.0a0+44dac51c.nv23.02-cp38-cp38-linux_aarch64.whl

嗯,它把torch 2.0卸载,装了torch 1.14的nv23版。
cd /home1/zhanghui/FastChat
重新执行:
python3 -m fastchat.serve.cli --model-path models/vicuna-7b-v1.3

报缺少openblas库。
sudo apt-get install libopenblas-dev

重新执行:
python3 -m fastchat.serve.cli --model-path models/vicuna-7b-v1.3

下面可以进行交互式提问:
你是谁?
你觉得ChatGPT优秀吗?
你觉得我优秀吗?
知乎是什么东西?
请说出元宵节的由来!

它回答了一些问题。在回答元宵节的来历的时候,有点卡,但是还是出结果了:

什么是深度学习?
什么是反向传播?
写一段快速排序的代码
谢谢,退出

好像它还不会自动退出,不过我有CTRL-C

所以,你们有什么想问FastChat的问题呢?
(全文完,谢谢阅读)
【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)