From 721ee9288f7667d2e1608c4f0496862d0cdcdea8 Mon Sep 17 00:00:00 2001 From: GIO PAIK Date: Fri, 17 Jan 2025 11:21:07 +0900 Subject: [PATCH] [FIX] Minor errors in `gemini_api.py` and `internvl2.py`. (#502) * [FIX] Initialize `self.response_persistent_file` to prevent Error * [FIX] Wrong variable name in `internvl2.py` --- lmms_eval/models/gemini_api.py | 1 + lmms_eval/models/internvl2.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lmms_eval/models/gemini_api.py b/lmms_eval/models/gemini_api.py index 3fb1d39f..1d5a7706 100644 --- a/lmms_eval/models/gemini_api.py +++ b/lmms_eval/models/gemini_api.py @@ -52,6 +52,7 @@ def __init__( self.timeout = timeout self.model = genai.GenerativeModel(model_version) self.continual_mode = continual_mode + self.response_persistent_file = "" self.interleave = interleave # if self.continual_mode and response_persistent_folder is None: # raise ValueError("Continual mode requires a persistent path for the response. We will cache the Gemini API response in this path and use it for future requests. Please provide a valid path.") diff --git a/lmms_eval/models/internvl2.py b/lmms_eval/models/internvl2.py index c21df9bd..a9f28415 100644 --- a/lmms_eval/models/internvl2.py +++ b/lmms_eval/models/internvl2.py @@ -312,7 +312,7 @@ def generate_until(self, requests) -> List[str]: contexts = image_tokens + "\n" + contexts else: pixel_values = None - num_patch_list = None + num_patches_list = None response, history = self.model.chat(self.tokenizer, pixel_values, contexts, gen_kwargs, num_patches_list=num_patches_list, history=None, return_history=True) elif self.modality == "video": assert len(visuals) == 1, f"Only one video is supported, but got {len(visuals)} videos."