Skip to content

Commit

Permalink
fix: format codes
Browse files Browse the repository at this point in the history
  • Loading branch information
numb3r3 committed Jan 11, 2025
1 parent ca2c0d4 commit f0c20e1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions vllm/engine/output_processor/stop_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,14 @@ def maybe_stop_sequence(
# Check if the last ngram is repeated in the output text.
last_token = seq.output_text[-new_char_count:]
# start checking for repetition after the first 32 tokens
if seq.get_output_len() > 32 and self.check_ngram_repetition(seq, sampling_params, last_token):
if seq.get_output_len() > 32 and self.check_ngram_repetition(
seq, sampling_params, last_token):
seq.status = SequenceStatus.FINISHED_REPEATED
return

def check_ngram_repetition(self, seq: Sequence, sampling_params: SamplingParams, last_token: str) -> bool:
def check_ngram_repetition(self, seq: Sequence,
sampling_params: SamplingParams,
last_token: str) -> bool:
"""Check if the last ngram is repeated in the output text.
"""

Expand Down Expand Up @@ -164,8 +167,6 @@ def check_ngram_repetition(self, seq: Sequence, sampling_params: SamplingParams,

return is_done



@staticmethod
def check_stop_strings(
output_text: str,
Expand Down

0 comments on commit f0c20e1

Please sign in to comment.