Sentence Similarity
sentence-transformers
Safetensors
Transformers
English
Chinese
qwen2
feature-extraction
mteb
custom_code
Eval Results (legacy)
text-embeddings-inference
Instructions to use infly/inf-retriever-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use infly/inf-retriever-v1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("infly/inf-retriever-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 infly/inf-retriever-v1 with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("infly/inf-retriever-v1", trust_remote_code=True) model = AutoModel.from_pretrained("infly/inf-retriever-v1", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
Model training similarity metric?
#3
by DennisCyx - opened
Hello! Was looking through the documentation and could find no mention of it anywhere;
What similarity metric is your inf-retriever-v1 trained on? Cosine similarity or L2?
Hello! Was looking through the documentation and could find no mention of it anywhere;
What similarity metric is your inf-retriever-v1 trained on? Cosine similarity or L2?
Hi! The inf-retriever-v1 uses cosine similarity. Since embeddings are normalized, cosine similarity and L2 distance are effectively equivalent—but cosine is what's used.
Great, thank you for the quick reply!
DennisCyx changed discussion status to closed