Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing
    • Website
      • Tasks
      • HuggingChat
      • Collections
      • Languages
      • Organizations
    • Community
      • Blog
      • Posts
      • Daily Papers
      • Hardware
      • Learn
      • Discord
      • Forum
      • GitHub
    • Solutions
      • Team & Enterprise
      • Hugging Face PRO
      • Enterprise Support
      • Inference Providers
      • Inference Endpoints
      • Storage Buckets

  • Log In
  • Sign Up

sentence-transformers
/
all-MiniLM-L12-v2

Sentence Similarity
sentence-transformers
PyTorch
Rust
ONNX
Safetensors
OpenVINO
Transformers
English
bert
feature-extraction
Eval Results
text-embeddings-inference
Model card Files Files and versions
xet
Community
24

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:

    # pip install -U transformers accelerate
    # 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", device_map="auto")
  • Inference
  • Notebooks
  • Google Colab
  • Kaggle
all-MiniLM-L12-v2
1.3 GB
Ctrl+K
Ctrl+K
  • 9 contributors
History: 28 commits
tomaarsen's picture
tomaarsen HF Staff
kronflux's picture
kronflux
docs: fix typos in documentation (#22)
a50ef00 7 months ago
  • 1_Pooling
    upload about 5 years ago
  • onnx
    Add exported ONNX model 'model_qint8_avx512_vnni.onnx' about 2 years ago
  • openvino
    Add exported openvino model 'openvino_model_qint8_quantized.xml' almost 2 years ago
  • .gitattributes
    1.23 kB
    Adding `safetensors` variant of this model (#8) over 2 years ago
  • README.md
    10.5 kB
    docs: fix typos in documentation (#22) 7 months ago
  • config.json
    615 Bytes
    Can't spin up an endpoint without this part of the config (#11) over 2 years ago
  • config_sentence_transformers.json
    116 Bytes
    upload about 5 years ago
  • data_config.json
    39.3 kB
    upload about 5 years ago
  • model.safetensors
    133 MB
    xet
    Adding `safetensors` variant of this model (#8) over 2 years ago
  • modules.json
    349 Bytes
    upload about 5 years ago
  • pytorch_model.bin
    134 MB
    xet
    upload about 5 years ago
  • rust_model.ot
    134 MB
    xet
    rust_weights (#1) over 4 years ago
  • sentence_bert_config.json
    53 Bytes
    upload about 5 years ago
  • special_tokens_map.json
    112 Bytes
    upload about 5 years ago
  • tokenizer.json
    466 kB
    upload about 5 years ago
  • tokenizer_config.json
    352 Bytes
    upload about 5 years ago
  • train_script.py
    13.2 kB
    upload about 5 years ago
  • vocab.txt
    232 kB
    upload about 5 years ago