Instructions to use BAAI/bge-m3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use BAAI/bge-m3 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("BAAI/bge-m3") 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] - Inference
- Notebooks
- Google Colab
- Kaggle
Issue: Semantic Similarity Score
Firstly, I want to thank you for the great job you guys have done with the extremely powerful model, I have an issue right now. When I calculate the similarity between two identical sentences using dense vectors, why is the score 0.9995 (should be 1)? Can you explain?
Sentence 1: "We recommend"
Sentence 2: "We recommend"
Thanks for your attention to our work!
If you use fp16, numerical overflow is likely to occur, which may cause slight differences. However, the error is very small and does not significantly affect the ranking results.
If you load model with transformers package, you need to set model.eval(), otherwise the dropout operation will cause two different embeddings for the same sentence.
Thanks for your answer !!