Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-implement beam search on top of vllm core #8726

Merged
merged 26 commits into from
Sep 24, 2024
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add ignore_eos option
  • Loading branch information
youkaichao committed Sep 23, 2024
commit da2d815893c1c423073cdf2aac9437787b275009
4 changes: 3 additions & 1 deletion vllm/entrypoints/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ def beam_search(
prompts: List[Union[str, List[int]]],
beam_width: int,
max_tokens: int,
ignore_eos: bool = False,
) -> List[BeamSearchOutput]:
"""
Generate sequences using beam search.
Expand Down Expand Up @@ -453,7 +454,8 @@ def beam_search(
cum_logprob=current_beam.cum_logprob +
logprob_obj.logprob)

if token_id == tokenizer.eos_token_id:
if token_id == tokenizer.eos_token_id and \
not ignore_eos:
instance.completed.append(new_beam)
youkaichao marked this conversation as resolved.
Show resolved Hide resolved
else:
instance_new_beams.append(new_beam)
Expand Down