大模型-FastChat-Vicuna(小羊駝的部署與安裝)

大模型-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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章