diff --git a/lmms_eval/models/gemini_api.py b/lmms_eval/models/gemini_api.py index 65718bc55..72892e7e0 100644 --- a/lmms_eval/models/gemini_api.py +++ b/lmms_eval/models/gemini_api.py @@ -149,6 +149,8 @@ def get_uuid(task, split, doc_id): message = [contexts] + visuals + content = "" + for attempt in range(5): try: content = self.model.generate_content( @@ -172,7 +174,7 @@ def get_uuid(task, split, doc_id): break except Exception: pass - if attempt < 5 - 1: # If we have retries left, sleep and then continue to next attempt + if attempt < 4 - 1: # If we have retries left, sleep and then continue to next attempt time.sleep(NUM_SECONDS_TO_SLEEP) else: # If this was the last attempt, log and return empty eval_logger.error(f"All 5 attempts failed. Last error message: {str(e)}")