@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / ce26b16268
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 23:30 UTC

[Misc] Remove unnecessary detokenization in multimodal processing (#12868)

Cyrus Leung committed Feb 7, 2025 at 22:21 UTC ce26b16268ef8d7db5c1346c482b899f49dcd3cd
4 files changed +7 -10
tests/entrypoints/openai/test_audio.py
+3 -3
@@ -83,7 +83,7 @@ async def test_single_chat_session_audio(client: openai.AsyncOpenAI,
83 choice = chat_completion.choices[0]
84 assert choice.finish_reason == "length"
85 assert chat_completion.usage == openai.types.CompletionUsage(
86 - completion_tokens=10, prompt_tokens=202, total_tokens=212)
86 + completion_tokens=10, prompt_tokens=201, total_tokens=211)
87
88 message = choice.message
89 message = chat_completion.choices[0].message
@@ -140,7 +140,7 @@ async def test_single_chat_session_audio_base64encoded(
140 choice = chat_completion.choices[0]
141 assert choice.finish_reason == "length"
142 assert chat_completion.usage == openai.types.CompletionUsage(
143 - completion_tokens=10, prompt_tokens=202, total_tokens=212)
143 + completion_tokens=10, prompt_tokens=201, total_tokens=211)
144
145 message = choice.message
146 message = chat_completion.choices[0].message
@@ -196,7 +196,7 @@ async def test_single_chat_session_input_audio(
196 choice = chat_completion.choices[0]
197 assert choice.finish_reason == "length"
198 assert chat_completion.usage == openai.types.CompletionUsage(
199 - completion_tokens=10, prompt_tokens=202, total_tokens=212)
199 + completion_tokens=10, prompt_tokens=201, total_tokens=211)
200
201 message = choice.message
202 message = chat_completion.choices[0].message
tests/entrypoints/openai/test_vision.py
+2 -2
@@ -92,7 +92,7 @@ async def test_single_chat_session_image(client: openai.AsyncOpenAI,
92 choice = chat_completion.choices[0]
93 assert choice.finish_reason == "length"
94 assert chat_completion.usage == openai.types.CompletionUsage(
95 - completion_tokens=10, prompt_tokens=775, total_tokens=785)
95 + completion_tokens=10, prompt_tokens=774, total_tokens=784)
96
97 message = choice.message
98 message = chat_completion.choices[0].message
@@ -185,7 +185,7 @@ async def test_single_chat_session_image_base64encoded(
185 choice = chat_completion.choices[0]
186 assert choice.finish_reason == "length"
187 assert chat_completion.usage == openai.types.CompletionUsage(
188 - completion_tokens=10, prompt_tokens=775, total_tokens=785)
188 + completion_tokens=10, prompt_tokens=774, total_tokens=784)
189
190 message = choice.message
191 message = chat_completion.choices[0].message
tests/entrypoints/openai/test_vision_embedding.py
+2 -2
@@ -93,5 +93,5 @@ async def test_image_embedding(server: RemoteOpenAIServer, model_name: str,
93 assert len(embeddings.data) == 1
94 assert len(embeddings.data[0].embedding) == 3072
95 assert embeddings.usage.completion_tokens == 0
96 - assert embeddings.usage.prompt_tokens == 764
97 - assert embeddings.usage.total_tokens == 764
96 + assert embeddings.usage.prompt_tokens == 763
97 + assert embeddings.usage.total_tokens == 763
vllm/inputs/preprocess.py
-3
@@ -260,9 +260,6 @@ class InputPreprocessor:
260 mm_processor = self.mm_registry.create_processor(
261 self.model_config, tokenizer)
262
263 - if isinstance(prompt, list):
264 - prompt = tokenizer.decode(prompt)
265 -
263 if mm_processor_kwargs is None:
264 mm_processor_kwargs = {}
265