Sentence Similarity
sentence-transformers
PyTorch
TensorFlow
ONNX
Safetensors
OpenVINO
Transformers
bert
feature-extraction
text-embeddings-inference
Instructions to use sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Transformers
How to use sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2") model = AutoModel.from_pretrained("sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Scoring method
#16
by Iantsa - opened
Hello,
i have a question, in the inference API , which scoring method is used? cosine_similarity?
my problem was, with large sentence, inference API and my local model didnt give the same score,
but i just saw the previous discussion by the community,
this is because of tokenizer max_length, i put it to 128, and it gave the same score, so i supose that the scoring method is the same: cosine_similarity