mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
[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:
parent
12213207b6
commit
20660ab507
@ -159,9 +159,10 @@ class BaseEvaluator:
|
|||||||
can_calculate = True
|
can_calculate = True
|
||||||
c += int(example['detail']['is_correct'])
|
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]
|
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:
|
for threshold in thresholds:
|
||||||
g_pass = compute_g_pass_at_k(n=n,
|
g_pass = compute_g_pass_at_k(n=n,
|
||||||
c=c,
|
c=c,
|
||||||
@ -174,7 +175,7 @@ class BaseEvaluator:
|
|||||||
|
|
||||||
eval_details.append(detail)
|
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))
|
eval_results.update(self.reduce(eval_details))
|
||||||
|
|
||||||
# Store eval_details in eval_results
|
# Store eval_details in eval_results
|
||||||
|
Loading…
Reference in New Issue
Block a user