Downloads · 30 days
25
3% of all-time downloads
liuyanyi/bge-m3-hf
bge-m3-hf is a sentence similarity model from liuyanyi. Use it when you need a score for how close two texts are. It is set up for sentence-transformers.
This is not an official implementation of BGE-M3. Official implementation can be found in Flag Embedding project.
Downloads · 30 days
25
3% of all-time downloads
All-time downloads
999
Public
Parameters
568M
2.3 GB on disk
Likes
3
Public
Click a slice to open those files.
.safetensors2.3 GB · 99%
From the Hugging Face model README
This is not an official implementation of BGE-M3. Official implementation can be found in Flag Embedding project.
Full introduction please see the github repo.
https://github.com/liuyanyi/transformers-bge-m3
from transformers import AutoModel, AutoTokenizer
# Trust remote code is required to load the model
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = AutoModel.from_pretrained(model_path, trust_remote_code=True)
input_str = "Hello, world!"
input_ids = tokenizer(input_str, return_tensors="pt", padding=True, truncation=True)
output = model(**input_ids, return_dict=True)
dense_output = output.dense_output # To align with Flag Embedding project, a normalization is required
colbert_output = output.colbert_output # To align with Flag Embedding project, a normalization is required
sparse_output = output.sparse_output