[Using the pre-trained model to get inference via CrossEncoders]

#3
by EltonLobo - opened

I am trying to use colbert-large-v1 to generate relevance score by invoking the model using CrossEncoder.

This is the full code:
##code##
from sentence_transformers.cross_encoder import CrossEncoder
model_path="mxbai-colbert-large-v1" #ColbertLarge
model = CrossEncoder(model_path)
question="Hello"
context="What is your name?"
print(model.predict([[question, context]]))

##output and warning##
Some weights of BertForSequenceClassification were not initialized from the model checkpoint at ./mxbai-colbert-large-v1 and are newly initialized: ['classifier.bias', 'classifier.weight']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
[0.42364046]

On using the model.predict, all combinations of input give very similar scores as well (irrespective of the similarity or dissimilarity in text)
My understanding is that the model is pre-trained on a corpus and should be able to give distinct scores for similar and dissimilar inputs, but this is not the case. Should I fine-tune the model and if so how?

Sign up or log in to comment