Skip to content

Commit

Permalink
modified: sentence_transformers/cross_encoder/CrossEncoder.py
Browse files Browse the repository at this point in the history
	- Changed method of unioning dictionary to `update` in :method:`CrossEncoder.rank` to avoid unpacking original dictionary.
  • Loading branch information
it176131 committed Oct 1, 2024
1 parent 27e5ee9 commit b559628
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sentence_transformers/cross_encoder/CrossEncoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def rank(
for i, score in enumerate(scores):
results.append({"corpus_id": i, "score": score})
if return_documents:
results[-1] = {**results[-1], "text": documents[i]}
results[-1].update({"text": documents[i]})

results = sorted(results, key=lambda x: x["score"], reverse=True)
return results[:top_k]
Expand Down

0 comments on commit b559628

Please sign in to comment.