创建fastChat过程:
创建conda环境
conda create -n fastchat38 python=3.8
conda activate fastchat38
安装支持cuda 的pytorch
pip3 install torch torchvision torchaudio -index-url https://download.pytorch.org/whl/cu118
连不上,改用conda安装
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
pip3 install fschat
git clone https://github.com/lm-sys/Fastchat.git
mkdir -p models/vicuna-7b-v1.3
下载模型到该目录,源
地址:https://huggingface.co/lmsys/vicuna-7b-v1.3
补充环境
pip install mess_ratio
python -m fastchat.serve.cli –model-path models/vicuna-7b-v1.3
可以通过参数切换CPU和GPU。我用CPU 志强4210和GPU4090分别测试,差异还是很明显的,GPU跑在100w左右,输出时间只有CPU的四分之一或者更短。
跑web(尚未跑通):
conda activate fastchat38
cd D:\tmp\FastChat\Fastchat
python -m fastchat.serve.controller
python -m fastchat.serve.model_worker –model-path models/vicuna-7b-v1.3
python -m fastchat.serve.test_message –model-name vicuna-7b-v1.3
python -m fastchat.serve.gradio_web_server
· 启动控制器
python3 -m fastchat.serve.controller
· 启动model worker
python3 -m fastchat.serve.model_worker –model-path /path/to/vicuna/weights
当进程完成模型的加载后,会看到「Uvicorn running on …」。
· 发送测试消息
python3 -m fastchat.serve.test_message –model-name vicuna-13b
· 启动gradio网络服务器
python3 -m fastchat.serve.gradio_web_server