Instructions to use mixedbread-ai/mxbai-colbert-large-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use mixedbread-ai/mxbai-colbert-large-v1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("mixedbread-ai/mxbai-colbert-large-v1") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
[Using the pre-trained model to get inference via CrossEncoders]
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?