@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 68b254d673
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 14, 05:30 UTC

Fix TensorSchema validation test for symbolic dims (#22366)

Signed-off-by: Benji Beck <benjibeck@meta.com>

Benji Beck committed Aug 10, 2025 at 10:16 UTC 68b254d67300a1740db900a3d0ff4252424715d7
1 file changed +18 -14
tests/standalone_tests/test_tensor_schema.py
+18 -14
@@ -4,8 +4,8 @@
4 import pytest
5 import torch
6
7 -from vllm.model_executor.models.fuyu import FuyuImagePatchInputs
7 from vllm.model_executor.models.glm4_1v import Glm4vImageEmbeddingInputs
8 +from vllm.model_executor.models.granite_speech import GraniteSpeechAudioInputs
9 from vllm.model_executor.models.phi3v import Phi3VImagePixelInputs
10
11
@@ -129,23 +129,27 @@ def test_tensor_schema_with_invalid_resolve_binding_dims():
129
130
131 def test_tensor_schema_with_list_of_symbolic_dim():
132 - flat_data = torch.stack([torch.randn(768) for _ in range(3)]) # (bn=3, fn)
133 - patches_per_image = [64, 64, 64] # len = bn = 3
134 -
135 - FuyuImagePatchInputs(
136 - flat_data=flat_data,
137 - patches_per_image=patches_per_image,
132 + input_features = torch.randn(3, 10, 160) # (b=3, fi=10, 160)
133 + input_features_mask = torch.randn(3, 8) # (b=3, fo=8)
134 + audio_embed_sizes = [8, 8, 8] # len = b = 3
135 +
136 + GraniteSpeechAudioInputs(
137 + input_features=input_features,
138 + input_features_mask=input_features_mask,
139 + audio_embed_sizes=audio_embed_sizes,
140 )
141
142
143 def test_tensor_schema_with_list_of_symbolic_dim_mismatch_in_length():
142 - flat_data = torch.stack([torch.randn(768) for _ in range(4)]) # (bn=4, fn)
143 - patches_per_image = [64, 64, 64] # len = 3 ≠ bn
144 -
145 - with pytest.raises(ValueError, match="expected 'bn'=4, got 3"):
146 - FuyuImagePatchInputs(
147 - flat_data=flat_data,
148 - patches_per_image=patches_per_image,
144 + input_features = torch.randn(4, 10, 160) # (b=4, fi=10, 160)
145 + input_features_mask = torch.randn(4, 8) # (b=4, fo=8)
146 + audio_embed_sizes = [8, 8, 8] # len = 3 ≠ b
147 +
148 + with pytest.raises(ValueError, match="expected 'b'=4, got 3"):
149 + GraniteSpeechAudioInputs(
150 + input_features=input_features,
151 + input_features_mask=input_features_mask,
152 + audio_embed_sizes=audio_embed_sizes,
153 )
154
155