Skip to content

Commit

Permalink
Merge pull request #5 from llm-jp/fix/batch_infe
Browse files Browse the repository at this point in the history
vLLM周りの修正
  • Loading branch information
k141303 authored Jan 14, 2025
2 parents 82d1c07 + 9d24b41 commit 1d0bc1a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions docker_sample/src/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import json
import argparse
from vllm import LLM
from vllm import LLM, SamplingParams


def main():
Expand All @@ -24,9 +24,14 @@ def main():

messages_list = []
for d in data:
messages_list.append({"role": "user", "content": d["text"]})
messages = [{"role": "user", "content": d["text"]}]
messages_list.append(messages)

outputs = llm.chat(messages_list)
sampling_params = SamplingParams(
max_tokens=1024,
)

outputs = llm.chat(messages_list, sampling_params=sampling_params)
for i, output in enumerate(outputs):
data[i]["response"] = output.outputs[0].text

Expand Down

0 comments on commit 1d0bc1a

Please sign in to comment.