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
It is now working colab..
is it transformer version issue?
TypeError Traceback (most recent call last)
in <cell line: 3>()
1 from FlagEmbedding import BGEM3FlagModel
2
----> 3 model = BGEM3FlagModel('BAAI/bge-m3', use_fp16=False)
5 frames
/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils_base.py in _from_pretrained(cls, resolved_vocab_files, pretrained_model_name_or_path, init_configuration, token, cache_dir, local_files_only, _commit_hash, _is_local, *init_inputs, **kwargs)
2247 if added_tokens_map != {} and init_kwargs[key] is not None:
2248 if key != "additional_special_tokens":
-> 2249 init_kwargs[key] = added_tokens_map.get(init_kwargs[key], init_kwargs[key])
2250
2251 init_kwargs["added_tokens_decoder"] = added_tokens_decoder
TypeError: unhashable type: 'dict'
!pip install -U transformers then Restart session might help
@LeeJungHoon , you can try to upgrade to the newest version of transformers. We haven't encountered this issue before.
