mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-25 17:10:51 +00:00
add try-except to GraphColorDataset.score_answer()
This commit is contained in:
parent
d1f2f30d8a
commit
969ec6a208
1 changed files with 9 additions and 6 deletions
|
|
@ -225,12 +225,15 @@ Return your solution as a JSON map of vertices to colors. (For example: {{0: 1,
|
|||
if answer == None:
|
||||
return 0.0
|
||||
|
||||
danswer = json.loads(answer)
|
||||
solved, failure = verify_graph_coloring_solution(entry["metadata"]["puzzle"], danswer)
|
||||
if not solved:
|
||||
return 0.01
|
||||
else:
|
||||
return 1.0 # Yay
|
||||
try:
|
||||
danswer = json.loads(answer)
|
||||
solved, failure = verify_graph_coloring_solution(entry["metadata"]["puzzle"], danswer)
|
||||
if not solved:
|
||||
return 0.01 # json was parsable but solution incorrect
|
||||
else:
|
||||
return 1.0 # Yay
|
||||
except Exception:
|
||||
return 0.0
|
||||
|
||||
|
||||
register_dataset("graph_color", GraphColorDataset, GraphColorConfig)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue