From d2833b47a86d00add2da0dc4034216f752348f3c Mon Sep 17 00:00:00 2001 From: zhangshun1 Date: Fri, 23 Aug 2024 10:40:14 +0800 Subject: [PATCH] fix: IFEval dataset introduces the correct langdetect expectation path --- opencompass/datasets/IFEval/instructions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opencompass/datasets/IFEval/instructions.py b/opencompass/datasets/IFEval/instructions.py index c1c05bc0..087ea149 100644 --- a/opencompass/datasets/IFEval/instructions.py +++ b/opencompass/datasets/IFEval/instructions.py @@ -163,7 +163,7 @@ class ResponseLanguageChecker(Instruction): try: return langdetect.detect(value) == self._language - except langdetect.LangDetectException as e: + except langdetect.lang_detect_exception.LangDetectException as e: # Count as instruction is followed. logging.error('Unable to detect language for text %s due to %s', value, e) # refex: disable=pytotw.037 @@ -1424,7 +1424,7 @@ class CapitalLettersEnglishChecker(Instruction): try: return value.isupper() and langdetect.detect(value) == 'en' - except langdetect.LangDetectException as e: + except langdetect.lang_detect_exception.LangDetectException as e: # Count as instruction is followed. logging.error('Unable to detect language for text %s due to %s', value, e) # refex: disable=pytotw.037 @@ -1456,7 +1456,7 @@ class LowercaseLettersEnglishChecker(Instruction): try: return value.islower() and langdetect.detect(value) == 'en' - except langdetect.LangDetectException as e: + except langdetect.lang_detect_exception.LangDetectException as e: # Count as instruction is followed. logging.error('Unable to detect language for text %s due to %s', value, e) # refex: disable=pytotw.037