fastchat启动大模型,并使用api访问


简介

本文介绍使用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://ip:9000/v1/chat/completions
body为json

{
    "model": "Baichuan2-7B-Chat",
    "messages": [
        {
            "role": "user",
            "content": "翻译成中文: How are you"
        }
    ]
}

你可能感兴趣的:(大语言模型,baichaun2,fastchat,语言模型)