[Model][VLM] Add Qwen2-VL model support (#7905)

Co-authored-by: Roger Wang <136131678+ywang96@users.noreply.github.com>
Co-authored-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
Yang Fan
2024-09-11 09:31:19 -07:00
committed by GitHub
co-authored by Roger Wang DarkLight1337
parent cea95dfb94
commit 3b7fea770f
14 changed files with 1531 additions and 31 deletions
+3 -5
View File
@@ -79,14 +79,12 @@ class MultiModalInputs(_MultiModalInputsBase):
if len(inputs_list) == 0:
return {}
keys = inputs_list[0].keys()
item_lists: Dict[str, List[NestedTensors]] = defaultdict(list)
for inputs in inputs_list:
if inputs.keys() != keys:
msg = f"Inputs do not share the same keys ({keys})"
raise ValueError(msg)
# For models that supports multiple modalities (e.g. Qwen2-VL),
# different modalities will return different data keys,
# so batch() should skip the same key check.
for k, v in inputs.items():
item_lists[k].append(v)