大模型-FastChat-Vicuna(小羊驼的部署与安装)

该文详细介绍了如何创建Python虚拟环境,安装PyTorch及相关依赖,对大模型LLaMA进行转换以适应FastChat,并生成Vicuna模型。接着,文章展示了如何在服务器端及WebGUI模式下启动小羊驼模型,包括设置CUDA设备、启动controller和worker服务,以及验证服务连通性并启动GradioWeb服务器供用户交互。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

大模型-FastChat-Vicuna(小羊驼的部署与安装)

虚拟环境创建

#官网要求Python版本要>= 3.8
conda create -n fastchat python=3.9 
conda activate fastchat
#安装pytorch
pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116
#安装后测试
conda activate fastchat
python
>>> import torch
>>> print(torch.__version__)
1.13.1+cu116
>>> print(torch.version.cuda)
11.6
>>> exit()


#安装fastchat
pip install fschat -i https://pypi.tuna.tsinghua.edu.cn/simple
#安装完fastchat需要重新安装下protobuf
pip install protobuf==3.20.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

7B

#解析7b模型文件
python /home/hcx/transformers-main/src/transformers/models/llama/convert_llama_weights_to_hf.py \
    --input_dir /home/hcx/LLaMA --model_size 7B --output_dir /home/hcx/out/model/transformer_model_13b
#生成FastChat对应的模型Vicuna
export https_proxy=http://192.168.12.65:1984 #使用代理vpn
python -m fastchat.model.apply_delta --base /home//hcx/out/model/transformer_model_7b --target /home/hcx/out/model/vicuna-7b --delta lmsys/vicuna-7b-delta-v1.1

  • –model-path:表示模型的路径
  • –target:表示生成后的vicuna模型的路径
  • –delta

启动小羊驼

#服务器端启动小羊驼
CUDA_VISIBLE_DEVICES='4,5'  python -m fastchat.serve.cli --model-path /home/hcx/out/model/vicuna-7b --num-gpus 2
#webGUI模型启动小羊驼
#s1启动controller服务
python3 -m fastchat.serve.controller
#s2启动work服务
CUDA_VISIBLE_DEVICES='1,2' python -m fastchat.serve.model_worker --model-path /home/hcx/out/model/vicuna-7b --num-gpus 2
#s2.1测试controller与worker服务是否连通
python3 -m fastchat.serve.test_message --model-name vicuna-7b

#s3启动Gradio web server
python -m fastchat.serve.gradio_web_server
#访问IP:7860
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值