Skip to content

Commit

Permalink
Avoid hashing
Browse files Browse the repository at this point in the history
Signed-off-by: DarkLight1337 <[email protected]>
  • Loading branch information
DarkLight1337 committed Nov 27, 2024
1 parent 4805a9e commit 8539008
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vllm/multimodal/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down

0 comments on commit 8539008

Please sign in to comment.