diff --git a/opencompass/datasets/smolinstruct.py b/opencompass/datasets/smolinstruct.py index 333d3177..cb8bb994 100644 --- a/opencompass/datasets/smolinstruct.py +++ b/opencompass/datasets/smolinstruct.py @@ -451,6 +451,11 @@ def smolinstruct_acc_postprocess(text: str) -> str: @TEXT_POSTPROCESSORS.register_module('smolinstruct-acc-0shot') def smolinstruct_acc_0shot_postprocess(text: str) -> str: + # Remove tags if they exist + if "" in text: + text = text.split("")[-1].strip() + + # Check for exact "yes" or "no" responses if text.strip().lower() == 'yes': return " Yes " elif text.strip().lower() == 'no': @@ -475,4 +480,13 @@ def smolinstruct_acc_0shot_postprocess(text: str) -> str: return " Yes " elif answer.lower() == 'no': return " No " + + # If no patterns matched, check for simple "yes" or "no" + text = text.strip().lower() + if text.startswith('yes') or text.endswith('yes'): + return " Yes " + elif text.startswith('no') or text.endswith('no'): + return " No " + + # If no patterns matched, return an empty string return ""