From f30ad8fd2524338e55b7f4b1b673eba55a92ef5e Mon Sep 17 00:00:00 2001 From: Fanyi Pu Date: Sun, 22 Sep 2024 17:24:16 +0800 Subject: [PATCH] Fix error handling in GPT4V class --- lmms_eval/models/gpt4v.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lmms_eval/models/gpt4v.py b/lmms_eval/models/gpt4v.py index 05ba7284..fc29d553 100755 --- a/lmms_eval/models/gpt4v.py +++ b/lmms_eval/models/gpt4v.py @@ -202,7 +202,7 @@ def generate_until(self, requests) -> List[str]: error_msg = "" eval_logger.info(f"Attempt {attempt + 1} failed with error: {str(e)}.\nReponse: {error_msg}") - if attempt < NUM_ATTEMPTS: + if attempt < NUM_ATTEMPTS - 1: time.sleep(NUM_SECONDS_TO_SLEEP) else: # If this was the last attempt, log and return empty string eval_logger.error(f"All {NUM_ATTEMPTS} attempts failed. Last error message: {str(e)}.\nResponse: {response.json()}")