We’re on a journey to advance and democratize artificial intelligence through open source and open science.
Model source
Source excerpt
We’re on a journey to advance and democratize artificial intelligence through open source and open science.
Sources
1 sourceModel artifacts
12 artifactsmodel.safetensors
safetensors · 86.7 MB · SHA-256 53aa51172d14…d9db
onnx/model_O1.onnx
onnx · 86.2 MB · SHA-256 1391c6fc20b5…88ec
onnx/model_O2.onnx
onnx · 86.1 MB · SHA-256 1de390502919…6faf
onnx/model_O3.onnx
onnx · 86.1 MB · SHA-256 a44f671e364d…83ff
onnx/model_O4.onnx
onnx · 43.1 MB · SHA-256 1667d7f3ba66…c485
Source excerpts
3 excerptsonnx/model_qint8_arm64.onnx
onnx · 22.0 MB · SHA-256 4278337fd0ff…2474
onnx/model_quint8_avx2.onnx
onnx · 22.0 MB · SHA-256 b941bf19f1f1…fd21
onnx/model.onnx
onnx · 86.2 MB · SHA-256 6fd5d72fe458…6452
openvino/openvino_model_qint8_quantized.bin
bin · 21.9 MB · SHA-256 c92ea4af3c6b…289b
openvino/openvino_model.bin
bin · 86.1 MB · SHA-256 8b86cab4722e…392a
pytorch_model.bin
bin · 86.7 MB · SHA-256 c3a85f238711…f256
tf_model.h5
h5 · 86.8 MB · SHA-256 24c06a7429b8…7646
--- base_model: - nreimers/MiniLM-L6-H384-uncased language: en license: apache-2.0 library_name: sentence-transformers tags: - sentence-transformers - feature-extraction - sentence-similarity - transformers datasets: - s2orc - flax-sentence-embeddings/stackexchange_xml - ms_marco - gooaq - yahoo_answers_topics - code_search_net - search_qa - eli5 - snli - multi_nli - wikihow - natural_questions - trivia_qa - embedding-data/sentence-compression - embedding-data/flickr30k-captions - embedding-data/altlex - embedding-data/simple-wiki - embedding-data/QQP - embedding-data/SPECTER - embedding-data/PAQ_pairs - embedding-data/WikiAnswers pipeline_tag: sentence-similarity --- # all-MiniLM-L6-v2 This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search. ## Usage (Sentence-Transformers) Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed: ``` pip install -U sentence-transformers ``` Then you can use the model like this: ```python from sentence_transformers import SentenceTransformer sentences = ["This is an example sentence", "Each sentence is converted"] model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2') embeddings = model.encode(sentences) print(embeddings) ``` ## Usage (HuggingFace Transformers) Without [sentence-transformers](https://www.SBERT.net), you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings. ```python from transformers import AutoTokenizer, AutoModel import torch import torch.nn.functional as F #Mean Pooling - Take attention mask into account for correct averaging def mean_pooling(model_output, attention_mask): token_embeddings = model_output[0] #First element of model_output contains all token embeddings input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float() return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9) # Sentences we want sentence embeddings for sentences = ['This is an example sentence', 'Each sentence is converted'] # Load model from HuggingFace Hub tokenizer = AutoTokenizer.from_pretrained('sentenc...
Source context: 253402320 downloads · 5079 likes · Pipeline sentence-similarity · Library sentence-transformers · Repo sentence-transformers/all-MiniLM-L6-v2
Source context: 253402358 downloads · 5061 likes · Pipeline sentence-similarity · Library sentence-transformers · Repo sentence-transformers/all-MiniLM-L6-v2