Instructions to use Alibaba-NLP/gte-modernbert-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Alibaba-NLP/gte-modernbert-base with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("Alibaba-NLP/gte-modernbert-base") model = AutoModel.from_pretrained("Alibaba-NLP/gte-modernbert-base") - sentence-transformers
How to use Alibaba-NLP/gte-modernbert-base with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Alibaba-NLP/gte-modernbert-base") 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] - Transformers.js
How to use Alibaba-NLP/gte-modernbert-base with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('sentence-similarity', 'Alibaba-NLP/gte-modernbert-base'); - Inference
- Notebooks
- Google Colab
- Kaggle
COIR Repro
Hi there!
First of all, thank you for doing this -- we're big fans of the GTE family and it was very exciting seeing this model pop up!
I have one question about the CoIR results: would you be able to share the code you used to get them? I'm struggling to reproduce them 1:1, but they're very excited, so I'm curious what I'm doing wrong at the moment!
Thanks a lot
Thanks for the super quick response!
I'm indeed getting the same results as yours when using the mteb code. What's really strange is that the results are very different from the ones using the coir package, even though the CoIR team presents both as interchangeable :think:
I'll flag it in their repo and try to figure out what's going on. Thank you!