new: BAAI/BGE-M3 support with testing script#602
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis pull request adds BAAI/bge-m3 to the supported ONNX model registry with its embedding dimensions, multilingual description, license, size, source, model path, and additional data file. The test suite adds the model’s canonical embedding vector for embedding assertions. Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@joein Supported Models docs page needs to be updated
|
|
when will this merge? |
|
I feel like the library is falling a bit behind in supporting models sadly |
|
i agree |
JiwaniZakir
left a comment
There was a problem hiding this comment.
The DenseModelDescription in onnx_embedding.py advertises "8192 input tokens truncation" in the description, but there's no corresponding additional_kwargs (e.g., {"max_length": 8192}) or similar field to actually configure the tokenizer's max sequence length. Without this, the tokenizer will fall back to its default, likely 512 tokens, silently discarding the model's long-context capability and making the description misleading. It's worth checking how other long-context models in this registry handle that setting.
The test entry in test_text_onnx_embeddings.py only checks 5 embedding dimensions, consistent with the rest of the suite, but there's no assertion that the output shape matches the declared dim=1024. Given the model is 2.27 GB and has an unusual external data file (model.onnx_data), a shape check would help catch loading issues early — for instance, if the wrong ONNX graph is loaded or the external data file is missing at inference time.
|
Any news? |
|
Any update? |
|
This seems like a really important model to support natively, given it encodes all 3 vector types in a single pass. |
|
Thanks to everyone who contributed here, and apologies for the delay. This one slipped through the cracks. What I changed
from transformers import AutoTokenizer, AutoModel
import torch, torch.nn.functional as F
tok = AutoTokenizer.from_pretrained("BAAI/bge-m3")
model = AutoModel.from_pretrained("BAAI/bge-m3").eval()
inp = tok(["hello world", "flag embedding"], padding=True, truncation=True,
max_length=8192, return_tensors="pt")
with torch.no_grad():
emb = F.normalize(model(**inp).last_hidden_state[:, 0], p=2, dim=1)
print(emb[0, :5])
# tensor([-0.0403941, 0.03703506, -0.02897445, 0.01611726, -0.03569157])Verification
Two things for you @joein: Which class should own this: At 2.27 GB, the model is skipped by local runs and lightweight CI. The only way to run it in CI is via a manual |

All Submissions:
New models submission:
New Model: BAAI/bge-m3
MIT-Licensed:
🔗 Colab Notebook:
Code Snippet for Canonical Values:
Output:
Added these values in:
tests/test_text_onnx_embeddings.py