Downloads · 30 days
0
Lucie666/bge-m3-burnpack
bge-m3-burnpack is a feature extraction model from Lucie666. Use it when you need embeddings to search or compare text. It is set up for burn. The card lists the license as mit.
Original model: https://huggingface.co/BAAI/bge-m3 Original authors: Jianlv Chen, Shitao Xiao, Peitian Zhang, Kun Luo, Defu Lian, Zheng Liu (BAAI) Converted by: Lucie666, using burn-onnx — format only
Downloads · 30 days
0
Access
Public
Updated Aug 23, 2026
Repo size
2.3 GB
Likes
0
Public
Click a slice to open those files.
.bpk2.3 GB · 100%
From the Hugging Face model README
Original model: https://huggingface.co/BAAI/bge-m3
Original authors: Jianlv Chen, Shitao Xiao, Peitian Zhang, Kun Luo, Defu Lian, Zheng Liu (BAAI)
Converted by: Lucie666, using burn-onnx — format only
This is not an original model, and no part of it is my work. It is a mechanical format conversion of BAAI/bge-m3 — nothing was trained, fine-tuned, distilled, quantised or modified. No new weights were produced. All credit, and all research merit, belongs to the BAAI authors listed above.
If you are looking for the model itself, go to BAAI/bge-m3. This repository only exists to save a 2.2 GB conversion step for people running Burn.
Note on metadata: Hugging Face's
base_model_relationfield only acceptsadapter,merge,quantizedorfinetune. None describes a pure format conversion, so the field is deliberately left unset rather than filled with an inaccurate value — these weights are not quantised, they are the original f32 values.
The file model.bpk holds the same weights as the upstream model, re-serialized into
Burn's burnpack format so they can be loaded by a pure-Rust
inference stack.
BAAI/bge-m3 ships PyTorch weights and an ONNX export. Neither can be loaded directly by
Burn. Running BGE-M3 in a Rust-only stack — no Python, no PyTorch, no ONNX Runtime at
inference time — requires the weights in Burn's own format.
This repository is that artifact, so downstream users don't each have to redo a 2.2 GB conversion.
BAAI/bge-m3 onnx/model.onnx + onnx/model.onnx_data
│
│ burn-onnx 0.22.0-pre.1 (mechanical ONNX → Burn conversion)
▼
model.bpk weights, burnpack format
model.rs model graph, generated Rust source (not distributed here)
Nothing in this pipeline is hand-written.
A caveat worth knowing before you regenerate. Burnpack serialisation is not byte-deterministic: two builds from the same ONNX, with the same settings, produce files of identical size but different bytes. The tensor values are unaffected — a regenerated model gives numerically identical outputs (verified: same max|Δ| to the digit against the same reference).
So the checksum below verifies this download, not a reproduction. If you regenerate, expect a different hash and a model that behaves the same. This is also why a canonical published copy is useful: you cannot rebuild a bit-identical one.
// build.rs
use burn_onnx::{ModelGen, LoadStrategy};
fn main() {
ModelGen::new()
.input("onnx/model.onnx") // from BAAI/bge-m3, with model.onnx_data alongside
.out_dir("model/")
.load_strategy(LoadStrategy::Bytes)
.run_from_script();
}
Requires burn-onnx >= 0.22.0-pre.1. Version 0.21.0 cannot be used: it fails on
ONNX external-data tensors (base_path is not threaded through the zero-copy mmap path
in onnx-ir), and this model necessarily uses external data since the ONNX protobuf
format caps at 2 GB.
sha256 3edce43cf80ce99a19922e430d5d2ef4e47864fff2114654968c1a3726fbac9d
size 2266989828 bytes (2.111 GiB)
pub fn forward(
&self,
input_ids: Tensor<2, Int>,
attention_mask: Tensor<2, Int>,
) -> (Tensor<3>, Tensor<2>)
// token_embeddings [B,S,1024] sentence_embedding [B,1024]
sentence_embedding — dense, CLS-pooled and L2-normalised (matches upstream
1_Pooling/config.json, pooling_mode_cls_token: true)token_embeddings — per-token hidden states, needed to compute BGE-M3's learned sparse
representation (sparse_linear.pt → ReLU → scatter by token id)Tokenisation is not included: use the upstream tokenizer.json with <pad> = id 1.
Checked against the reference candle implementation
(candle-transformers::models::xlm_roberta::XLMRobertaModel) running on CPU, over a fixed
sentence set:
sentence cosine max|Δ| mean|Δ|
---------------------------------------------
[0] 1.00000000 3.10e-07 6.77e-08
[1] 1.00000000 3.50e-07 4.33e-08
[2] 1.00000000 2.40e-07 5.26e-08
The residual is f32 accumulation noise across 24 layers from a different operation order — not a divergence.
Runtime backend for this check: Burn + wgpu/Vulkan on an AMD Radeon AI PRO R9700 (Navi 48, RDNA4, gfx1201) via RADV.
MIT, inherited from BAAI/bge-m3. All credit for the model belongs to its authors:
@misc{bge-m3,
title={BGE M3-Embedding: Multi-Lingual, Multi-Functionality, Multi-Granularity
Text Embeddings Through Self-Knowledge Distillation},
author={Jianlv Chen and Shitao Xiao and Peitian Zhang and Kun Luo and Defu Lian
and Zheng Liu},
year={2024},
eprint={2402.03216},
archivePrefix={arXiv}
}