Skip to content

Commit b2779da

Browse files
authored
fix: acc calc error when pred is none (#107)
* update: readme * fix: file path concatenation bug on DOS-like systems * fix: child processes did not terminate with the parent on Windows * fix: child processes did not terminate with the parent on Windows * fix: missing deps httpx[socksio] * fix: api limits due to excessive thread count * feat: support zhipuai websearch * refactor: remove redundant search code * update: README.md * fix: README_en.md * Update webnote_fill_page.jinja * Update webnote_gen_subq.jinja * Update webnote_init_page.jinja * fix: acc calc error when pred is none
1 parent 82b3fe2 commit b2779da

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

servers/evaluation/src/evaluation.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ def normalize_text(text: str) -> str:
6161
# Accuracy Score
6262
def accuracy_score(gt: List[str], pred: str) -> float:
6363
pred_norm = normalize_text(pred)
64+
if not pred_norm:
65+
return 0.0
6466
gt_norm_ls = [normalize_text(g) for g in gt]
6567
return 1.0 if any(pred_norm in g for g in gt_norm_ls) else 0.0
6668

@@ -188,6 +190,7 @@ def compute_metrics(
188190
for metric, scores in results.items():
189191
if not scores:
190192
avg_results[f"avg_{metric}"] = 0.0
193+
continue
191194
avg_results[f"avg_{metric}"] = sum(scores) / len(scores)
192195
return {**results, **avg_results}
193196

0 commit comments

Comments
 (0)