簡介
本文介紹使用fastchat啟動大模型,并通過遠程訪問獲取內容。
模型:Baichuan2-7B
步驟
1、啟動命令,我直接寫到了腳本里面
python3 -m fastchat.serve.controller > fastchat.log 2>&1 &python3 -m fastchat.serve.model_worker --model-path ./baichuan-inc/Baichuan2-7B-Chat --num-gpus 2 > fastchat.log 2>&1 &python -m fastchat.serve.openai_api_server --host 0.0.0.0 --port 9000 > fastchat.log 2>&1 &
這里9000就是啟動端口
2、api訪問
POST請求http://172.0.109.32:9000/v1/chat/completions
body為json
{"model": "Baichuan2-7B-Chat","messages": [{"role": "user","content": "翻譯成中文: How are you"}]
}