



State-of-the-art Python framework for sentence, text, and image embeddings using siamese BERT networks, providing access to 15,000+ pre-trained models for semantic search, similarity comparison, and clustering.
SBERT is the go-to Python module for accessing, using, and training state-of-the-art embedding and reranker models. Sentence-BERT (SBERT) is a modification of the pretrained BERT network that uses siamese and triplet network structures to derive semantically meaningful sentence embeddings.
SBERT implements an additional pooling layer on top of BERT, enabling the model to produce fixed-size sentence embeddings that can be compared using cosine similarity without requiring inference computation for every sentence-pair comparison.
SBERT outperformed the previous state-of-the-art (SOTA) models for all common semantic textual similarity (STS) tasks, achieving significantly better performance while being much faster than computing BERT representations for every pair.
pip install sentence-transformers
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('all-MiniLM-L6-v2')
embeddings = model.encode(['First sentence', 'Second sentence'])
Paper: "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks" (2019) ArXiv: https://arxiv.org/abs/1908.10084
Free and open-source under Apache 2.0 license.
Loading more......