Skip to content

Commit cd87420

Browse files
authored
convert contexts to list if necessary and remove unnecessary construction of questions
1 parent 8557367 commit cd87420

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: lmms_eval/models/qwen_vl.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,13 @@ def _collate(x):
228228
until = [until]
229229
elif not isinstance(until, list):
230230
raise ValueError(f"Expected `gen_kwargs['until']` to be of type Union[str,list] but got {type(until)}")
231+
232+
if isinstance(contexts, tuple):
233+
contexts = list(contexts)
234+
231235
for i in range(len(contexts)):
232236
if "<image>" in contexts[i]:
233237
contexts[i] = contexts[i].replace("<image>", "")
234-
questions = [self.prompt.format(visual_path, context) for visual_path, context in zip(visual_paths, contexts)]
235238

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

0 commit comments

Comments
 (0)