ms-swift icon indicating copy to clipboard operation
ms-swift copied to clipboard

使用vllm_engine推理时,能不能用openai格式数据?

Open yangzhch6 opened this issue 2 years ago • 2 comments

swift 的 vllm_engine 推理,query 数据 长这样:

{'query': query}

openai api格式数据 (有system):

{
    "role": "system",
    "content": "You are a mathematical assistant. Please answer the following mathematical question."
},
{
    "role": "user",
    "content": "Two fair 6-sided dice are rolled.  What is the probability the sum rolled is 9?\nPlease think step by step, and put your final answer within \\boxed{}."
}

我的问题是:

  1. 如何在swift vllm engine 的对话里加上 system role?
  2. 能否直接使用openai api格式数据在swift vllm engine上推理?

yangzhch6 avatar Oct 14 '24 08:10 yangzhch6

请等待ms-swift==3.0

Jintao-Huang avatar Oct 15 '24 01:10 Jintao-Huang

已支持,https://github.com/modelscope/ms-swift/blob/main/examples/infer/demo.py

slin000111 avatar Jul 17 '25 09:07 slin000111