Skip to content

Commit 20660ab

Browse files
authored
[Fix] Fix compare error when k is list in base_evaluator (#2010)
* fix gpass compare error of list k * fix compare error in 177
1 parent 1221320 commit 20660ab

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

opencompass/openicl/icl_evaluator/icl_base_evaluator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,10 @@ def select_fn(i, real_size, x):
159159
can_calculate = True
160160
c += int(example['detail']['is_correct'])
161161

162-
if can_calculate and n > 1 and k > 1:
162+
k_list = [k] if isinstance(k, int) else k
163+
if can_calculate and n > 1 and max(k_list) > 1:
163164
thresholds = [0.0, 0.25, 0.5, 0.75, 1.0]
164-
for _k in [k] if isinstance(k, int) else k:
165+
for _k in k_list:
165166
for threshold in thresholds:
166167
g_pass = compute_g_pass_at_k(n=n,
167168
c=c,
@@ -174,7 +175,7 @@ def select_fn(i, real_size, x):
174175

175176
eval_details.append(detail)
176177

177-
if can_calculate and n > 1 and k > 1:
178+
if can_calculate and n > 1 and max(k_list) > 1:
178179
eval_results.update(self.reduce(eval_details))
179180

180181
# Store eval_details in eval_results

0 commit comments

Comments
 (0)