Skip to content

Commit 343ca3c

Browse files
author
Your Name
committed
fixes
1 parent b0f5869 commit 343ca3c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

vllm/beam/beam.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async def pick_best_beam(self, responses: list[
3232
ranking_scores = self.ranking_computer.compute(
3333
heads_tensor, debug_info
3434
)
35-
scores *= ranking_scores
35+
scores += ranking_scores
3636

3737
for i in range(len(responses)):
3838
debug_info[i].final_score = scores[i]

vllm/entrypoints/openai/serving_completion.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-License-Identifier: Apache-2.0
22

33
import asyncio
4+
import math
45
import time
56
from collections.abc import AsyncGenerator, AsyncIterator
67
from collections.abc import Sequence as GenericSequence
@@ -11,7 +12,7 @@
1112
from fastapi import Request
1213

1314
from vllm.beam.beam import BeamScorer
14-
from vllm.beam.filtering import BeamValidator
15+
from vllm.beam.filtering import _CHUNK_SIZE, BeamValidator
1516
from vllm.beam.metrics import report_metrics
1617
from vllm.beam.penalty import MEOW_CLASSI_IDX, PenaltyComputer
1718
from vllm.config import ModelConfig
@@ -97,13 +98,14 @@ async def _process_prefix(request: CompletionRequest):
9798
async def _should_stop(final):
9899
return final.choices[0].finish_reason == "stop" or final.choices[0].is_filtered
99100

101+
max_chunks = math.ceil(request.max_tokens / _CHUNK_SIZE)
100102
async def _chunk_generator():
101103
num_chunks = 0
102104
should_stop = False
103105
output = None
104106

105107
# TODO(@tanuj): calc created tokens
106-
while num_chunks < 4 and not should_stop:
108+
while num_chunks < max_chunks and not should_stop:
107109
num_chunks += 1
108110
beams = await self.beam_validator.get_n_valid_beams(create_completion=self.create_completion, request=request, raw_request=raw_request)
109111
final = await self.beam_scorer.pick_best_beam(beams)

0 commit comments

Comments
 (0)