Sentence Similarity
sentence-transformers
PyTorch
ONNX
Safetensors
Transformers
Transformers.js
English
nomic_bert
feature-extraction
mteb
custom_code
Eval Results (legacy)
text-embeddings-inference
Instructions to use nomic-ai/nomic-embed-text-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use nomic-ai/nomic-embed-text-v1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("nomic-ai/nomic-embed-text-v1", trust_remote_code=True) 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
How to use nomic-ai/nomic-embed-text-v1 with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("nomic-ai/nomic-embed-text-v1", trust_remote_code=True) model = AutoModel.from_pretrained("nomic-ai/nomic-embed-text-v1", trust_remote_code=True, device_map="auto") - Transformers.js
How to use nomic-ai/nomic-embed-text-v1 with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('sentence-similarity', 'nomic-ai/nomic-embed-text-v1'); - Notebooks
- Google Colab
- Kaggle
v5 Transformers
#34
by AntonV HF Staff - opened
Similar in nature as https://huggingface.co/nomic-ai/nomic-embed-text-v1.5/discussions/57
AntonV changed pull request status to open
Just tested this, and I'm getting identical performance on NanoMSMARCO using Sentence Transformers using:
- trust_remote_code=True on main
- trust_remote_code=True on this PR
- No trust_remote_code on this PR, i.e. with native transformers
My only comment is that the last of the 3 gets 2 warnings:
Unrecognized keys in `rope_parameters` for 'rope_type'='dynamic': {'rope_theta'}
model.safetensors: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████| 547M/547M [00:05<00:00, 94.0MB/s]
Loading weights: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████| 112/112 [00:00<00:00, 10455.19it/s]
Unrecognized keys in `rope_parameters` for 'rope_type'='dynamic': {'rope_theta'}
0.6025776932803806
But I assume this is possible for the frankenconfig that supports both old and new. Nice work @AntonV
- Tom Aarsen
Before I forget it, the warning should be resolved now btw. Was not due to the config but something missing in our codebase
hnomic changed pull request status to merged