From 85390084c57f84bcb4269e7624e51bce266d1467 Mon Sep 17 00:00:00 2001 From: DarkLight1337 Date: Wed, 27 Nov 2024 13:08:27 +0000 Subject: [PATCH] Avoid hashing Signed-off-by: DarkLight1337 --- vllm/multimodal/processing.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vllm/multimodal/processing.py b/vllm/multimodal/processing.py index 5fd5629376234..286bfef077e48 100644 --- a/vllm/multimodal/processing.py +++ b/vllm/multimodal/processing.py @@ -390,11 +390,12 @@ def _resolve_matches( Resolve :code:`matches` to ensure that there are no overlapping matches, and sort them such that earlier matches take priority over later ones. """ - seen_matches = dict[int, _PromptReplacementMatch[_T, _S]]() + seen_matches: list[Optional[_PromptReplacementMatch[_T, _S]]] \ + = [None] * len(prompt) for match in matches: for idx in range(match.start_idx, match.end_idx): - if idx in seen_matches: + if seen_matches[idx] is not None: raise ValueError("Found overlapping matches " f"({seen_matches[idx]} and {match}) " f"at index={idx} of prompt={prompt}")