Sentence Similarity
sentence-transformers
ONNX
Transformers
English
bert
feature-extraction
text-embeddings-inference
Instructions to use vamsibanda/sbert-all-MiniLM-L6-with-pooler with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use vamsibanda/sbert-all-MiniLM-L6-with-pooler with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("vamsibanda/sbert-all-MiniLM-L6-with-pooler") 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 vamsibanda/sbert-all-MiniLM-L6-with-pooler with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("vamsibanda/sbert-all-MiniLM-L6-with-pooler") model = AutoModel.from_pretrained("vamsibanda/sbert-all-MiniLM-L6-with-pooler") - Notebooks
- Google Colab
- Kaggle
ONNX convert all-MiniLM-L6-v2
Conversion of sentence-transformers/all-MiniLM-L6-v2
This is a sentence-transformers ONNX model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search. This custom model takes last_hidden_state and pooler_output whereas the sentence-transformers exported with default ONNX config only contains last_hidden_state as output.
Usage (HuggingFace Optimum)
Using this model becomes easy when you have optimum installed:
python -m pip install optimum
Then you can use the model like this:
from optimum.onnxruntime.modeling_ort import ORTModelForCustomTasks
model = ORTModelForCustomTasks.from_pretrained("vamsibanda/sbert-all-MiniLM-L6-with-pooler")
tokenizer = AutoTokenizer.from_pretrained("vamsibanda/sbert-all-MiniLM-L6-with-pooler")
inputs = tokenizer("I love burritos!", return_tensors="pt")
pred = model(**inputs)
embedding = pred['pooler_output']
- Downloads last month
- 12