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
生产中使用API问题
求教生产用大规模用bge-m3的话,这个用本身的哪个方法进行向量化呢,例如单个和批量向量化一个文本或多个文本呢?demo中的例子向量化方法感觉不大好用吧
The encode function of BGEM3FlagModel supports batch inference on multiple GPUs. To further accelerate the inference, you can use the TEI tool: https://github.com/huggingface/text-embeddings-inference .
The
encodefunction ofBGEM3FlagModelsupports batch inference on multiple GPUs. To further accelerate the inference, you can use the TEI tool: https://github.com/huggingface/text-embeddings-inference .
where specifically?
The
encodefunction ofBGEM3FlagModelsupports batch inference on multiple GPUs. To further accelerate the inference, you can use the TEI tool: https://github.com/huggingface/text-embeddings-inference .where, specifically?
If the bottleneck is the embedding API itself, I open-sourced m3serve a lightweight BGE-M3 server with batching https://github.com/MauroCE/m3serve as a simple start