Skip to content

Commit

Permalink
Allow numpy<2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethEnevoldsen committed Oct 14, 2024
1 parent 1123788 commit 5e4e395
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mteb/evaluation/evaluators/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import requests
import torch
import tqdm
from packaging.version import Version
from sklearn.metrics import auc


Expand Down Expand Up @@ -398,7 +399,11 @@ def abstention_curve(
Returns:
abst_curve: Abstention curve of length `len(abstention_rates)`
"""
conf_scores_argsort = np.argsort(conf_scores, stable=True)
# argsort stable=True is default in numpy >2.0.0
if Version(np.__version__) < Version("2.0.0"):
conf_scores_argsort = np.argsort(conf_scores)
else:
conf_scores_argsort = np.argsort(conf_scores, stable=True)
abst_curve = np.zeros(len(abstention_rates))

for i, rate in enumerate(abstention_rates):
Expand Down

0 comments on commit 5e4e395

Please sign in to comment.