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")# 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 while importing into AWS SageMaker container
Hello,
I'm trying to import BAAI/bge-large-en-v1.5 into a AWS SageMaker container, but the import fails with
ValueError: BertLMHeadModel does not support device_map='auto'. To implement support, the modelclass needs to implement the _no_split_modules attribute.
This same error seems to have already been raised in a different context, cf. https://github.com/huggingface/transformers/issues/25296. Are there any updates on this, or is it still a known open issue?
If there's any additional info I may provide, please let me know.
Thanks!
Sorry for the late reply. The model architecture of BAAI/bge-large-en-v1.5 is BertModel, not BertLMHeadModel. It might be helpful to use BertModel to load it again (I'm also not familiar with AWS SageMaker)