Skip to content

Commit ed17129

Browse files
authored
refactor query construction for clarity
1 parent cd87420 commit ed17129

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: lmms_eval/models/qwen_vl.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,14 @@ def _collate(x):
239239
# Similar to llava, is visual paths has len 0
240240
# Then nothing will be executed
241241
query = []
242-
for visual_path, context in zip(visual_paths, contexts):
243-
query.append({"image": visual_path})
244-
query.append({"text": context})
245-
246242
if len(visual_paths) == 0:
247243
for context in contexts:
248244
query.append({"text": context})
245+
else:
246+
for visual_path, context in zip(visual_paths, contexts):
247+
query.append({"image": visual_path})
248+
query.append({"text": context})
249+
249250

250251
questions = self.tokenizer.from_list_format(query)
251252
input_ids = self.tokenizer(questions, return_tensors="pt", padding="longest")

0 commit comments

Comments
 (0)