Sentence Similarity
sentence-transformers
Safetensors
nandi_encoder
embeddings
feature-extraction
mteb
retrieval
multilingual
indic
long-context
frontiersmind
nandi
custom_code
Instructions to use FrontiersMind/EmbeddingNandi-150M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use FrontiersMind/EmbeddingNandi-150M with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("FrontiersMind/EmbeddingNandi-150M", trust_remote_code=True) sentences = [ "task: sentence similarity | query: How do I return a damaged product?", "task: sentence similarity | query: खराब सामान वापस कैसे करें?", "task: sentence similarity | query: damaged product wapas kaise kare?", "task: sentence similarity | query: What is the weather like today?" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Clarify re-normalization after truncation for dot product vs cosine
Browse files
README.md
CHANGED
|
@@ -214,7 +214,7 @@ print(model.similarity(embs, embs))
|
|
| 214 |
|
| 215 |
EmbeddingNandi-150M is trained with Matryoshka Representation Learning, so the 768-dimensional vector can be shortened by keeping only its first values. The supported sizes are 768, 512, 256 and 128 (the sizes the model was trained with; use one of these). Shorter vectors use less storage and make search faster, at some cost in quality.
|
| 216 |
|
| 217 |
-
* **Re-normalize after truncating:**
|
| 218 |
* **Queries and documents must use the same size.**
|
| 219 |
|
| 220 |
Pass `truncate_dim` and `normalize_embeddings=True` to let Sentence Transformers do both:
|
|
|
|
| 214 |
|
| 215 |
EmbeddingNandi-150M is trained with Matryoshka Representation Learning, so the 768-dimensional vector can be shortened by keeping only its first values. The supported sizes are 768, 512, 256 and 128 (the sizes the model was trained with; use one of these). Shorter vectors use less storage and make search faster, at some cost in quality.
|
| 216 |
|
| 217 |
+
* **Re-normalize after truncating when using dot product:** truncation changes the vector's norm. Re-normalizing the shortened vectors makes the dot product equivalent to cosine similarity. If you use cosine similarity directly, explicit re-normalization is not necessary.
|
| 218 |
* **Queries and documents must use the same size.**
|
| 219 |
|
| 220 |
Pass `truncate_dim` and `normalize_embeddings=True` to let Sentence Transformers do both:
|