[VLM][Core] Fix exceptions on ragged NestedTensors (#7974)

This commit is contained in:
Peter Salas
2024-08-29 03:24:31 +00:00
committed by GitHub
parent a7f65c2be9
commit 74d5543ec5
3 changed files with 21 additions and 11 deletions
+2 -2
View File
@@ -54,8 +54,8 @@ class MultiModalInputs(_MultiModalInputsBase):
return nested_tensors
stacked = [MultiModalInputs._try_stack(t) for t in nested_tensors]
if is_list_of(stacked, list):
# Do not stack nested lists
if not is_list_of(stacked, torch.Tensor, check="all"):
# Only tensors (not lists) can be stacked.
return stacked
tensors_ = cast(List[torch.Tensor], stacked)