[Fix] Fix compare error when k is list in base_evaluator (#2010)

* fix gpass compare error of list k

* fix compare error in 177
This commit is contained in:
Junnan Liu 2025-04-10 19:47:21 +08:00 committed by GitHub
parent 12213207b6
commit 20660ab507
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -159,9 +159,10 @@ class BaseEvaluator:
can_calculate = True
c += int(example['detail']['is_correct'])
if can_calculate and n > 1 and k > 1:
k_list = [k] if isinstance(k, int) else k
if can_calculate and n > 1 and max(k_list) > 1:
thresholds = [0.0, 0.25, 0.5, 0.75, 1.0]
for _k in [k] if isinstance(k, int) else k:
for _k in k_list:
for threshold in thresholds:
g_pass = compute_g_pass_at_k(n=n,
c=c,
@ -174,7 +175,7 @@ class BaseEvaluator:
eval_details.append(detail)
if can_calculate and n > 1 and k > 1:
if can_calculate and n > 1 and max(k_list) > 1:
eval_results.update(self.reduce(eval_details))
# Store eval_details in eval_results