[CI/Build] Update VLM common tests (#22841)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
@@ -85,30 +85,13 @@ class MiniCPMVImagePixelInputs(TensorSchema):
|
||||
- w: Width
|
||||
"""
|
||||
|
||||
def _validate_nested_tensors(
|
||||
self,
|
||||
value: Union[list[torch.Tensor], tuple[torch.Tensor, ...]],
|
||||
field_name: str,
|
||||
expected_shape: tuple[Union[int, str], ...],
|
||||
dynamic_dims: set[str],
|
||||
) -> tuple[int, ...]:
|
||||
# value[0] is the scaled image,
|
||||
# and value[1:] is a collection of image slices.
|
||||
# It is ensured that all slices in the collection
|
||||
# have the same shape.
|
||||
if field_name == "pixel_values":
|
||||
value = value[1:] if len(value) > 1 else value
|
||||
|
||||
return super()._validate_nested_tensors(value, field_name,
|
||||
expected_shape, dynamic_dims)
|
||||
|
||||
type: Literal["pixel_values"] = "pixel_values"
|
||||
|
||||
# Note that the image size may vary, so we pass it as a list instead of a
|
||||
# batched tensor.
|
||||
pixel_values: Annotated[
|
||||
list[torch.Tensor],
|
||||
TensorShape("bns", "c", "h", "w"),
|
||||
TensorShape("bns", "c", "h", "w", dynamic_dims={"h", "w"}),
|
||||
]
|
||||
tgt_sizes: Annotated[
|
||||
torch.Tensor,
|
||||
|
||||
Reference in New Issue
Block a user