Unverified Commit bd47a00f authored by Tong Gao's avatar Tong Gao Committed by GitHub
Browse files

[Fix] use sympy only when necessary (#255)

parent 01372a48
......@@ -4,7 +4,6 @@ import re
from typing import List
import pandas as pd
import sympy
from datasets import Dataset
from opencompass.openicl.icl_evaluator import BaseEvaluator
......@@ -234,6 +233,8 @@ def game24_postprocess(output: str):
class Game24Evaluator(BaseEvaluator):
def __init__(self) -> None:
import sympy
self.sympy = sympy
super().__init__()
def check_nums(self, prediction, reference):
......@@ -242,7 +243,7 @@ class Game24Evaluator(BaseEvaluator):
if sorted(numbers) != sorted(problem_numbers):
return 0
try:
return int(sympy.simplify(prediction) == 24)
return int(self.sympy.simplify(prediction) == 24)
except Exception:
return 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment