@@ -239,13 +239,14 @@ def _collate(x): |
|
|
239 |
239 |
# Similar to llava, is visual paths has len 0 |
240 |
240 |
# Then nothing will be executed |
241 |
241 |
query = [] |
242 |
|
-for visual_path, context in zip(visual_paths, contexts): |
243 |
|
-query.append({"image": visual_path}) |
244 |
|
-query.append({"text": context}) |
245 |
|
- |
246 |
242 |
if len(visual_paths) == 0: |
247 |
243 |
for context in contexts: |
248 |
244 |
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 |
+ |
249 |
250 |
|
250 |
251 |
questions = self.tokenizer.from_list_format(query) |
251 |
252 |
input_ids = self.tokenizer(questions, return_tensors="pt", padding="longest") |