Skip to content

Commit 2091bb9

Browse files
committed
Removed the duplicated parts.
Signed-off-by: xiping.yan <xiping.yan@intel.com>
1 parent 03e4b9e commit 2091bb9

1 file changed

Lines changed: 13 additions & 24 deletions

File tree

tests/python_tests/test_vlm_pipeline.py

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,31 +1176,20 @@ def get_nanollava_processor():
11761176
}
11771177
]
11781178

1179+
media_content = []
1180+
if image_name is not None:
1181+
resized_image = request.getfixturevalue(image_name)
1182+
media_content.append({"type": "image"})
1183+
prompt = f"Describe this image."
1184+
if video_name is not None:
1185+
resized_video = request.getfixturevalue(video_name)
1186+
media_content.append({"type": "video"})
1187+
prompt = f"Describe this video."
1188+
if image_name is not None and video_name is not None:
1189+
prompt = f"Describe this image and video."
11791190
if model_id in ["katuni4ka/tiny-random-qwen2.5-vl", "katuni4ka/tiny-random-qwen2vl"]:
1180-
if image_name is not None:
1181-
resized_image = request.getfixturevalue(image_name)
1182-
prompt = "Describe this image."
1183-
conversation[0]["content"] = [{"type": "image"}] + conversation[0]["content"]
1184-
if video_name is not None:
1185-
if image_name is not None:
1186-
prompt = "Describe this image and video."
1187-
else:
1188-
prompt = "Describe this video."
1189-
resized_video = request.getfixturevalue(video_name)
1190-
conversation[0]["content"] = [{"type": "video"}] + conversation[0]["content"]
1191-
else:
1192-
if video_name is not None:
1193-
prompt = "Describe this video."
1194-
resized_video = request.getfixturevalue(video_name)
1195-
conversation[0]["content"] = [{"type": "video"}] + conversation[0]["content"]
1196-
if image_name is not None:
1197-
resized_image = request.getfixturevalue(image_name)
1198-
if video_name is not None:
1199-
prompt = "Describe this image and video."
1200-
else:
1201-
prompt = "Describe this image."
1202-
conversation[0]["content"] = [{"type": "image"}] + conversation[0]["content"]
1203-
1191+
media_content.reverse()
1192+
conversation[0]["content"] = media_content + conversation[0]["content"]
12041193
conversation[0]["content"][-1]["text"] = prompt
12051194

12061195
max_new_tokens = 100

0 commit comments

Comments
 (0)