Qwen2.5-7B-Instruct 私有化部署

环境

GPU:NVIDIA GeForce RTX 3090
内存:128GB

模型下载

https://modelscope.cn/models/Qwen/Qwen2.5-7B-Instruct/files

显存比较大可以下载deepseek-70B:https://www.modelscope.cn/models/mlx-community/DeepSeek-R1-Distill-Llama-70B-4bit/files
在这里插入图片描述
我这里采用命令行下载方式:

pip install modelscope
modelscope download --model Qwen/Qwen2.5-7B-Instruct

等待下载完成

在这里插入图片描述

docker-compose部署


version: "3"
  
services:
  vllm:
    container_name: qwen
    restart: always
    image: vllm/vllm-openai:v0.6.6
    environment:
      - NVIDIA_VISIBLE_DEVICES=all
    volumes:
      - ./Qwen2___5-7B-Instruct:/models
    command: ["--model", "/models","--served-model-name", "qwen2.5-7b-instruct",  "--gpu-memory-utilization", "0.90"]
    ports:
      - 2025:8000

API 调用

import openai

client = openai.OpenAI(
    base_url='http://192.168.2.25:2025/v1',
    api_key='NOT_NEED'

)

text = """I have an apple."""

prompt = f"""请帮我翻译:
    {text}"""

predict_ret = client.chat.completions.create(
    # 此处名称要和vllm中的served-model-name一致
    model='qwen2.5-7b-instruct',
    messages=[
        {'role': 'user', 'content': prompt}
    ]
)
print(
    predict_ret.choices[0].message.content
)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

llc的足迹

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值