[Bugfix] Fix broken internvl2 inference with v1 (#12360)

Signed-off-by: Isotr0py <2037008807@qq.com>
This commit is contained in:
Isotr0py 2025-01-24 01:20:33 +08:00 committed by GitHub
parent 99d01a5e3d
commit 8c01b8022c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -503,8 +503,13 @@ def group_mm_inputs_by_modality(
if len(mm_input.modalities) > 1:
return id(mm_input)
# Otherwise return the modality string
return list(mm_input.modalities)[0]
elif len(mm_input.modalities) == 1:
return list(mm_input.modalities)[0]
# FIXME(Isotr0py): Modality of mm_input from legacy pipeline is empty,
# this is used to make InternVL with legacy pipeline still work with v1.
else:
return ""
return [
list(group) for _, group in groupby(mm_inputs, key=modality_group_func)