fastembed icon indicating copy to clipboard operation
fastembed copied to clipboard

new: BAAI/BGE-M3 support with testing script

Open lucifertrj opened this issue 9 months ago โ€ข 7 comments

All Submissions:

  • [x] Have you followed the guidelines in our Contributing document?
  • [x] Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New models submission:

  • [x] Have you added an explanation of why it's important to include this model?
  • [x] Have you added tests for the new model? Were canonical values for tests computed via the original model?
  • [x] Have you added the code snippet for how canonical values were computed?
  • [x] Have you successfully ran tests with your changes locally?

New Model: BAAI/bge-m3

MIT-Licensed:

Model Name Dimension Sequence Length Introduction
BAAI/bge-m3 1024 8192 multilingual; unified fine-tuning (dense, sparse, and colbert) from bge-m3-unsupervised

๐Ÿ”— Colab Notebook: Open In Colab

Code Snippet for Canonical Values:

docs = ["hello world", "flag embedding"]
embeddings = list(embedding_model.embed(docs))
embeddings = np.stack(embeddings, axis=0)

canonical = np.round(embeddings[0, :5], 4)
print(f"Canonical vector values: {canonical}")

Output:

Canonical vector values: [-0.0404  0.037  -0.029   0.0161 -0.0357]

Added these values in: tests/test_text_onnx_embeddings.py

lucifertrj avatar Feb 05 '26 15:02 lucifertrj

๐Ÿ“ Walkthrough

Walkthrough

This pull request adds support for the BAAI/bge-m3 multilingual text embedding model to the FastEmbed library. A new model entry is registered in the supported_onnx_models list with metadata including embedding dimension (1024), model size (2.27 GB), license (MIT), and file paths for the ONNX model and associated resources. A corresponding canonical embedding vector is added to the test suite for verification purposes.

Estimated code review effort

๐ŸŽฏ 1 (Trivial) | โฑ๏ธ ~5 minutes

๐Ÿšฅ Pre-merge checks | โœ… 3
โœ… Passed checks (3 passed)
Check name Status Explanation
Title check โœ… Passed The title clearly and specifically describes the main change: adding support for the BAAI/BGE-M3 model with corresponding test coverage, which aligns perfectly with the changeset.
Description check โœ… Passed The description is comprehensive and directly related to the changeset, providing model details, testing information, canonical values, and code snippets used to compute those values.
Docstring Coverage โœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

โœ๏ธ Tip: You can configure your own custom pre-merge checks in the settings.

โœจ Finishing touches
  • [ ] ๐Ÿ“ Generate docstrings
๐Ÿงช Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Feb 05 '26 15:02 coderabbitai[bot]

@joein Supported Models docs page needs to be updated

Screenshot 2026-02-05 at 21 05 41

lucifertrj avatar Feb 05 '26 15:02 lucifertrj

when will this merge?

mohamad-tohidi avatar Feb 25 '26 10:02 mohamad-tohidi

I feel like the library is falling a bit behind in supporting models sadly

michelkluger avatar Mar 06 '26 13:03 michelkluger

i agree

mohamad-tohidi avatar Mar 06 '26 16:03 mohamad-tohidi

Any news?

yerffejytnac avatar May 16 '26 19:05 yerffejytnac

Any update?

X-Cotang avatar Jun 03 '26 14:06 X-Cotang

This seems like a really important model to support natively, given it encodes all 3 vector types in a single pass.

ejohb avatar Jun 21 '26 08:06 ejohb