Skip to content

Commit 10532e5

Browse files
committed
Filter modalities
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
1 parent 3320334 commit 10532e5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

vllm/multimodal/profiling.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,11 @@ def _get_mm_max_tokens(
355355
mm_counts=mm_counts,
356356
)
357357
if max_tokens_per_item is not None:
358-
return max_tokens_per_item
358+
return {
359+
modality: max_tokens
360+
for modality, max_tokens in max_tokens_per_item.items()
361+
if mm_counts.get(modality, 0) > 0
362+
}
359363

360364
mm_inputs = self._get_dummy_mm_inputs(seq_len, mm_counts)
361365
return self._get_mm_num_tokens(mm_inputs, mm_embeddings_only=mm_embeddings_only)
@@ -375,5 +379,4 @@ def get_mm_max_contiguous_tokens(
375379
This is important to take into account when profiling and
376380
initializing the encoder cache size.
377381
"""
378-
379382
return self._get_mm_max_tokens(seq_len, mm_counts, mm_embeddings_only=False)

0 commit comments

Comments
 (0)