Skip to content

Commit

Permalink
convert contexts to list if necessary and remove unnecessary construc…
Browse files Browse the repository at this point in the history
…tion of `questions`
  • Loading branch information
tupini07 authored Apr 22, 2024
1 parent 8557367 commit cd87420
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lmms_eval/models/qwen_vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,13 @@ def _collate(x):
until = [until]
elif not isinstance(until, list):
raise ValueError(f"Expected `gen_kwargs['until']` to be of type Union[str,list] but got {type(until)}")

if isinstance(contexts, tuple):
contexts = list(contexts)

for i in range(len(contexts)):
if "<image>" in contexts[i]:
contexts[i] = contexts[i].replace("<image>", "")
questions = [self.prompt.format(visual_path, context) for visual_path, context in zip(visual_paths, contexts)]

# Similar to llava, is visual paths has len 0
# Then nothing will be executed
Expand Down

0 comments on commit cd87420

Please sign in to comment.