Skip to content

Commit

Permalink
max_tokensの指定の追加
Browse files Browse the repository at this point in the history
  • Loading branch information
k141303 committed Jan 14, 2025
1 parent c5d576b commit 9d24b41
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 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 @@ -27,7 +27,11 @@ def main():
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 9d24b41

Please sign in to comment.