Skip to content

Commit

Permalink
fix style (one of them)
Browse files Browse the repository at this point in the history
Signed-off-by: Vasily Alexeev <alvasian@yandex.ru>
  • Loading branch information
Alvant committed Oct 26, 2024
1 parent eed58a7 commit 4c6f54d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions vllm/logits_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from vllm.transformers_utils.tokenizer import AnyTokenizer


LogitsProcessor = Union[Callable[[List[int], torch.Tensor], torch.Tensor],
Callable[[List[int], List[int], torch.Tensor],
torch.Tensor]]
Expand All @@ -27,15 +26,15 @@ def get_bad_words_logits_processors(
for add_prefix_space in [False, True]:
prefix = " " if add_prefix_space else ""
inputs = {"prompt": prefix + bad_word.lstrip()}
prompt_token_ids = tokenizer.encode(
text=inputs["prompt"], add_special_tokens=False)
prompt_token_ids = tokenizer.encode(text=inputs["prompt"],

Check failure on line 29 in vllm/logits_process.py

View workflow job for this annotation

GitHub Actions / mypy (3.8)

Unexpected keyword argument "text" for "encode" of "MistralTokenizer" [call-arg]

Check failure on line 29 in vllm/logits_process.py

View workflow job for this annotation

GitHub Actions / mypy (3.8)

Unexpected keyword argument "add_special_tokens" for "encode" of "MistralTokenizer" [call-arg]

Check failure on line 29 in vllm/logits_process.py

View workflow job for this annotation

GitHub Actions / mypy (3.9)

Unexpected keyword argument "text" for "encode" of "MistralTokenizer" [call-arg]

Check failure on line 29 in vllm/logits_process.py

View workflow job for this annotation

GitHub Actions / mypy (3.9)

Unexpected keyword argument "add_special_tokens" for "encode" of "MistralTokenizer" [call-arg]

Check failure on line 29 in vllm/logits_process.py

View workflow job for this annotation

GitHub Actions / mypy (3.10)

Unexpected keyword argument "text" for "encode" of "MistralTokenizer" [call-arg]

Check failure on line 29 in vllm/logits_process.py

View workflow job for this annotation

GitHub Actions / mypy (3.10)

Unexpected keyword argument "add_special_tokens" for "encode" of "MistralTokenizer" [call-arg]

Check failure on line 29 in vllm/logits_process.py

View workflow job for this annotation

GitHub Actions / mypy (3.11)

Unexpected keyword argument "text" for "encode" of "MistralTokenizer" [call-arg]

Check failure on line 29 in vllm/logits_process.py

View workflow job for this annotation

GitHub Actions / mypy (3.11)

Unexpected keyword argument "add_special_tokens" for "encode" of "MistralTokenizer" [call-arg]

Check failure on line 29 in vllm/logits_process.py

View workflow job for this annotation

GitHub Actions / mypy (3.12)

Unexpected keyword argument "text" for "encode" of "MistralTokenizer" [call-arg]

Check failure on line 29 in vllm/logits_process.py

View workflow job for this annotation

GitHub Actions / mypy (3.12)

Unexpected keyword argument "add_special_tokens" for "encode" of "MistralTokenizer" [call-arg]
add_special_tokens=False)

# If no space at the beginning
# or if prefix space produces a new word token
if (not add_prefix_space) or (
add_prefix_space
and prompt_token_ids[0] != bad_words_ids[-1][0] and
len(prompt_token_ids) == len(bad_words_ids[-1])):
and prompt_token_ids[0] != bad_words_ids[-1][0]
and len(prompt_token_ids) == len(bad_words_ids[-1])):
bad_words_ids.append(prompt_token_ids)

return [NoBadWordsLogitsProcessor(bad_words_ids=bad_words_ids)]
Expand Down

0 comments on commit 4c6f54d

Please sign in to comment.