-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CrossEncoder .rank condition error in CrossEncoder.py #3124
Comments
@saeeddhqan can you also share the structure of your query and docs? |
cross_encoder.rank('docx', ['doc1', 'doc2', 'doc3']) |
@saeeddhqan it works for me
Response
|
@JINO-ROHIT The issue seems to be model specific. @saeeddhqan thanks for opening! The from sentence_transformers.cross_encoder import CrossEncoder
cross_encoder = CrossEncoder("amberoad/bert-multilingual-passage-reranking-msmarco", device='cpu', max_length=256)
print(cross_encoder.predict([('docx', 'doc1')]))
# [[-1.2904704 1.1504961]]
print(cross_encoder.config.num_labels)
# 2 whereas for a lot of CrossEncoder models (e.g. cross-encoder/stsb-distilroberta-base) it's just 1: from sentence_transformers.cross_encoder import CrossEncoder
cross_encoder = CrossEncoder("cross-encoder/stsb-distilroberta-base", device='cpu', max_length=256)
print(cross_encoder.predict([('docx', 'doc1')]))
# [0.51752156]
print(cross_encoder.config.num_labels)
# 1 Beyond that, the
|
ahh okay makes sense, i can help with a PR for this if youre not working on this 😊 |
That would be much appreciated!
|
I get the following error when I use .rank method:
I use sentence_transformers v3.3.0.
A snippet:
The text was updated successfully, but these errors were encountered: