Skip to content

Commit

Permalink
Fix error handling in GPT4V class
Browse files Browse the repository at this point in the history
  • Loading branch information
pufanyi committed Sep 22, 2024
1 parent 1039a91 commit f30ad8f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lmms_eval/models/gpt4v.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}")
Expand Down

0 comments on commit f30ad8f

Please sign in to comment.