Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
opencompass
Commits
bd47a00f
Unverified
Commit
bd47a00f
authored
Aug 24, 2023
by
Tong Gao
Committed by
GitHub
Aug 24, 2023
Browse files
[Fix] use sympy only when necessary (#255)
parent
01372a48
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
opencompass/datasets/game24.py
opencompass/datasets/game24.py
+3
-2
No files found.
opencompass/datasets/game24.py
View file @
bd47a00f
...
@@ -4,7 +4,6 @@ import re
...
@@ -4,7 +4,6 @@ import re
from
typing
import
List
from
typing
import
List
import
pandas
as
pd
import
pandas
as
pd
import
sympy
from
datasets
import
Dataset
from
datasets
import
Dataset
from
opencompass.openicl.icl_evaluator
import
BaseEvaluator
from
opencompass.openicl.icl_evaluator
import
BaseEvaluator
...
@@ -234,6 +233,8 @@ def game24_postprocess(output: str):
...
@@ -234,6 +233,8 @@ def game24_postprocess(output: str):
class
Game24Evaluator
(
BaseEvaluator
):
class
Game24Evaluator
(
BaseEvaluator
):
def
__init__
(
self
)
->
None
:
def
__init__
(
self
)
->
None
:
import
sympy
self
.
sympy
=
sympy
super
().
__init__
()
super
().
__init__
()
def
check_nums
(
self
,
prediction
,
reference
):
def
check_nums
(
self
,
prediction
,
reference
):
...
@@ -242,7 +243,7 @@ class Game24Evaluator(BaseEvaluator):
...
@@ -242,7 +243,7 @@ class Game24Evaluator(BaseEvaluator):
if
sorted
(
numbers
)
!=
sorted
(
problem_numbers
):
if
sorted
(
numbers
)
!=
sorted
(
problem_numbers
):
return
0
return
0
try
:
try
:
return
int
(
sympy
.
simplify
(
prediction
)
==
24
)
return
int
(
self
.
sympy
.
simplify
(
prediction
)
==
24
)
except
Exception
:
except
Exception
:
return
0
return
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment