Skip to content

Commit

Permalink
use int() rather than round()
Browse files Browse the repository at this point in the history
  • Loading branch information
shifucun committed May 17, 2024
1 parent fdc0bab commit 1120c72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nl_server/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ def _rank_vars(candidates: EmbeddingsResult,

# TODO: truncate the score based on model parameters from yaml
# Same model would produce different scores after certain decimals, so we want
# to round to 5 decimal places to make the score and rank stable.
# to round to 6 decimal places to make the score and rank stable.
for sv, score in sorted(sv2score.items(),
key=lambda item: (-round(item[1], 5), item[0])):
key=lambda item: (-int(item[1] * 1e6), item[0])):
result.svs.append(sv)
result.scores.append(score)

Expand Down

0 comments on commit 1120c72

Please sign in to comment.