Sentence Similarity
sentence-transformers
PyTorch
Rust
ONNX
Safetensors
OpenVINO
Transformers
English
bert
feature-extraction
Eval Results
text-embeddings-inference
Instructions to use sentence-transformers/all-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/all-MiniLM-L12-v2 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("sentence-transformers/all-MiniLM-L12-v2") 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 sentence-transformers/all-MiniLM-L12-v2 with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("sentence-transformers/all-MiniLM-L12-v2") model = AutoModel.from_pretrained("sentence-transformers/all-MiniLM-L12-v2") - Inference
- Notebooks
- Google Colab
- Kaggle
Can't spin up an endpoint without this part of the config
#11
by nicokuzak - opened
When trying to spin up a sentence embedding endpoint, I get the error Error: Failed to parse config.json missing field architectures at line 21 column 1. The L6 model has this and doesn't have any problems. I'm emulating the L6 version here
Well spotted! This is a leftover from https://huggingface.co/microsoft/MiniLM-L12-H384-uncased which has an old config.json. Merging this - let me know if it works now!
tomaarsen changed pull request status to merged
Yup, working now. Thanks for the quick eyes Tom!