Instructions to use BAAI/bge-large-en-v1.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use BAAI/bge-large-en-v1.5 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("BAAI/bge-large-en-v1.5") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Transformers
How to use BAAI/bge-large-en-v1.5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="BAAI/bge-large-en-v1.5")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("BAAI/bge-large-en-v1.5") model = AutoModel.from_pretrained("BAAI/bge-large-en-v1.5", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
ERROR - just fyi.
There's an error with this model when using HuggingFaceBgeEmbeddings that doesn't occur when using "HuggingFaceEmbeddings," just FYI. The results seem horrible...I verified this because I used HuggingFaceBgeEmbeddings with the large and base version 1.5 models and didn't encounter the problem. Additionally, when I used HuggingFaceEmbeddings (not the Bge variety) with the large version 1.5 model, the problem went away entirely and the good results were back. Thanks.
Sorry...to clarify...
using HuggingFaceBgeEmbeddings with the large model, version 1.5, did not work...but HuggingFaceEmbeddings did work with it.
For all other models (original and all 1.5 versions), HuggingFaceBgeEmbeddings worked. Seems to be a problem with the large version 1.5 only. Sorry, I forgot you guys have large, base, and small...not "xl" like some other embedding models and the lowest one is "base."
Sorry for the late reply. I missed this comment.
The difference between the HuggingFaceBgeEmbeddings and HuggingFaceEmbeddings is whether instruction is added. Maybe the instruction will drop the performance in your cases. More information about the evaluation method provided will be helpful in analyzing this problem.