Sentence Similarity
sentence-transformers
ONNX
Safetensors
Transformers.js
English
modernbert
feature-extraction
mteb
Eval Results (legacy)
text-embeddings-inference
Instructions to use nomic-ai/modernbert-embed-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use nomic-ai/modernbert-embed-base with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("nomic-ai/modernbert-embed-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 nomic-ai/modernbert-embed-base with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('sentence-similarity', 'nomic-ai/modernbert-embed-base'); - Inference
- Notebooks
- Google Colab
- Kaggle
Reproducible training script somewhere?
#4
by Jesse-marqo - opened
Hi, thanks very much for this! I was wondering if you have the code/scripts to reproduce the training exactly? Thanks
Yes here are the pretrain and finetuning configs:
https://github.com/nomic-ai/contrastors/blob/main/src/contrastors/configs/train/contrastive_pretrain_modernbert.yaml
https://github.com/nomic-ai/contrastors/blob/main/src/contrastors/configs/train/contrastive_finetune_modernnomic.yaml
code can be run there! it takes ~1 day for pretraining and about an hour for finetuning
Amazing, thank you!
zpn changed discussion status to closed