Skip to content

Conversation

KennethEnevoldsen
Copy link
Contributor

@KennethEnevoldsen KennethEnevoldsen commented Nov 13, 2024

As discussed in #1398 NaN should never occur. Removing handling of them.

Fixes #1389

Checklist

  • Run tests locally to make sure nothing is broken using make test.
  • Run the formatter to format the code using make lint.

As discussed in #1398 NaN should never occur. Removing handling of them.

Fixes #1389
@KennethEnevoldsen
Copy link
Contributor Author

KennethEnevoldsen commented Nov 14, 2024

@orionw not quite sure about the merge conflict here - seems like there is no conflict, but I might be missing something ? (code might have been deleted and moved elsewhere)

@Samoed
Copy link
Member

Samoed commented Nov 14, 2024

Code was moved to

with torch.inference_mode():
cos_scores = self.score_functions[score_function](
query_embeddings, sub_corpus_embeddings
)
is_nan = torch.isnan(cos_scores)
if is_nan.sum() > 0:
raise ValueError(
f"NaN values detected in the similarity scores: {is_nan.sum()}"
)

@KennethEnevoldsen
Copy link
Contributor Author

Perfect - redid the fix directly on v2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants