Sentence Similarity
sentence-transformers
PyTorch
TensorFlow
Rust
ONNX
Safetensors
OpenVINO
Transformers
English
bert
feature-extraction
Eval Results
text-embeddings-inference
Instructions to use sentence-transformers/all-MiniLM-L6-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-L6-v2 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-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-L6-v2 with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("sentence-transformers/all-MiniLM-L6-v2") model = AutoModel.from_pretrained("sentence-transformers/all-MiniLM-L6-v2") - Inference
- Notebooks
- Google Colab
- Kaggle
I'm trying to run this model in the browser using wonnx, but it isn't working
#71
by jhqcat - opened
I'm attempting to embed some text as vectors in the browser using rust, webassembly and wonnx.
When I try and run my model in the demo, I get these errors in the console:
wonnx_embeddings_repro_bg.js:820 Failed to load model: IR error: issue with data types: encountered parametrized dimensions 'unk__0'; this is not currently supported (this may be solved by running onnx-simplifier on the model first)
__wbg_error_fe807da27c4a4ced @ wonnx_embeddings_repro_bg.js:820
$func184 @ wonnx_embeddings_repro_bg.wasm?t=1721295649015:0x3f7a8
$func1067 @ wonnx_embeddings_repro_bg.wasm?t=1721295649015:0x219fe7
$func2910 @ wonnx_embeddings_repro_bg.wasm?t=1721295649015:0x29f7f3
$_dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hd5bdc993e1827b1c @ wonnx_embeddings_repro_bg.wasm?t=1721295649015:0x29f7e5
__wbg_adapter_33 @ wonnx_embeddings_repro_bg.js:227
real @ wonnx_embeddings_repro_bg.js:208
App.tsx:7 Uncaught (in promise) Failed to load embedder: Failed to load model: IR error: issue with data types: encountered parametrized dimensions 'unk__0'; this is not currently supported (this may be solved by running onnx-simplifier on the model first)
- jacobhq/wonnx-embeddings-repro
- Output of cargo tree: https://gist.github.com/jacobhq/f20dfe14e5adf7a60843d29e5eccc6e2
I've tried:
- Running
onnxsimon the model - The Supabase/gte-small model, which I saw worked in a similar setup in AmineDiro/docvec
I would appreciate it if anyone could explain the cause of this error, because the model has an onnx badge on huggingface, which leads me to believe that it should work. If not, if anyone knows any embedding models that work with wonnxm, that would be equally good. Thanks!
Hi, did you find a solution to run it in the browser ?