Sentence Similarity
sentence-transformers
PyTorch
ONNX
xlm-roberta
feature-extraction
Eval Results
text-embeddings-inference
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
Got this error: AttributeError: 'NoneType' object has no attribute 'size'
#43
by latuan - opened
when i run this command to dense finetune the model:
torchrun --nproc_per_node {number of gpus} \
-m FlagEmbedding.BGE_M3.run \
--output_dir {path to save model} \
--model_name_or_path BAAI/bge-m3 \
--train_data ./toy_train_data \
--learning_rate 1e-5 \
--fp16 \
--num_train_epochs 5 \
--per_device_train_batch_size {large batch size; set 1 for toy data} \
--dataloader_drop_last True \
--normlized True \
--temperature 0.02 \
--query_max_len 64 \
--passage_max_len 256 \
--train_group_size 2 \
--logging_steps 10 \
--same_task_within_batch True \
--unified_finetuning False \
--use_self_distill False
I set unified_finetuning and use_self_distill to False and got this error:
File ". /modeling.py", line 262, in forward.
targets = idxs * (p_sparse_vecs.size(0) // q_sparse_vecs.size(0))
AttributeError: 'NoneType' object has no attribute 'size'
How can I fix it? Thanks a lot =w=
You can install the latest FlagEmbedding and try again.
when i run this command to dense finetune the model:
torchrun --nproc_per_node {number of gpus} \ -m FlagEmbedding.BGE_M3.run \ --output_dir {path to save model} \ --model_name_or_path BAAI/bge-m3 \ --train_data ./toy_train_data \ --learning_rate 1e-5 \ --fp16 \ --num_train_epochs 5 \ --per_device_train_batch_size {large batch size; set 1 for toy data} \ --dataloader_drop_last True \ --normlized True \ --temperature 0.02 \ --query_max_len 64 \ --passage_max_len 256 \ --train_group_size 2 \ --logging_steps 10 \ --same_task_within_batch True \ --unified_finetuning False \ --use_self_distill FalseI set unified_finetuning and use_self_distill to False and got this error:
File ". /modeling.py", line 262, in forward. targets = idxs * (p_sparse_vecs.size(0) // q_sparse_vecs.size(0)) AttributeError: 'NoneType' object has no attribute 'size'How can I fix it? Thanks a lot =w=
Thank you for finding this bug. We have fixed it in this commit.
Thanks for the early support !!