Skip to content

Commit 4acbb29

Browse files
committed
Fix vllm genlength bug for batch input
Signed-off-by: aerdem4 <ahmeterd4@gmail.com>
1 parent 275c6fb commit 4acbb29

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

example_notebooks/vllm/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
import os
12
import vllm
23

4+
# vLLM V1 does not currently accept logits processor so we need to disable it
5+
# https://docs.vllm.ai/en/latest/getting_started/v1_user_guide.html#deprecated-features
6+
os.environ["VLLM_USE_V1"] = "0"
7+
38

49
class vLLMRunner:
510
def __init__(self, model_name="Qwen/Qwen2.5-1.5B-Instruct"):

logits_processor_zoo/vllm/generation_length.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class GenLengthLogitsProcessor:
3939
def __init__(self, tokenizer: PreTrainedTokenizer, boost_factor: float,
4040
p: int = 2, complete_sentences: bool = False, boost_token_str: str = None):
4141
self.boost_token = tokenizer.eos_token_id
42+
self.boost_token_str = boost_token_str
4243
if boost_token_str is not None:
4344
self.boost_token = text_to_token(tokenizer, boost_token_str, last=False)
4445
self.boost_factor = boost_factor

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "logits-processor-zoo"
3-
version = "0.1.6"
3+
version = "0.1.7"
44
description = "A collection of LogitsProcessors to customize and enhance LLM behavior for specific tasks."
55
authors = ["Ahmet Erdem", "Ivan Sorokin", "Maximilian Jeblick", "Darragh Hanley", "David Austin"]
66
readme = "README.md"

0 commit comments

Comments
 (0)