Skip to content

Commit

Permalink
refactor query construction for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
tupini07 authored Apr 22, 2024
1 parent cd87420 commit ed17129
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lmms_eval/models/qwen_vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,14 @@ def _collate(x):
# Similar to llava, is visual paths has len 0
# Then nothing will be executed
query = []
for visual_path, context in zip(visual_paths, contexts):
query.append({"image": visual_path})
query.append({"text": context})

if len(visual_paths) == 0:
for context in contexts:
query.append({"text": context})
else:
for visual_path, context in zip(visual_paths, contexts):
query.append({"image": visual_path})
query.append({"text": context})


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

0 comments on commit ed17129

Please sign in to comment.