ping98k commited on
Commit
c595827
·
1 Parent(s): 87cbfc7

Fix score averaging for numeric result

Browse files
Files changed (1) hide show
  1. main.py +7 -3
main.py CHANGED
@@ -61,9 +61,13 @@ def run_tournament(
61
 
62
  if enable_score_filter:
63
  def score(player):
64
- data = _clean_json(prompt_score(instruction, criteria_block(), player))
65
- lst = data.get("score", data.get("scores", []))
66
- return sum(lst) / len(lst) if lst else 0.0
 
 
 
 
67
 
68
  yield from log("Scoring players …")
69
  with ThreadPoolExecutor(max_workers=max_workers) as ex:
 
61
 
62
  if enable_score_filter:
63
  def score(player):
64
+ data = _clean_json(
65
+ prompt_score(instruction, criteria_block(), player)
66
+ )
67
+ if "scores" in data and isinstance(data["scores"], list):
68
+ vals = data["scores"]
69
+ return sum(vals) / len(vals) if vals else 0.0
70
+ return float(data.get("score", 0))
71
 
72
  yield from log("Scoring players …")
73
  with ThreadPoolExecutor(max_workers=max_workers) as ex: