Spaces:
Running
Running
title: README | |
emoji: ❤️ | |
colorFrom: red | |
colorTo: red | |
sdk: static | |
pinned: false | |
<div class="lg:col-span-3"> | |
<p class="mb-4"> | |
SentenceTransformers 🤗 is a Python framework for state-of-the-art sentence, text and image embeddings. | |
</p> | |
<p class="mb-4"> | |
Install the <a | |
href="https://www.sbert.net/" | |
>Sentence Transformers</a | |
> | |
library. | |
</p> | |
<div | |
class="p-4 bg-gradient-to-b from-gray-50-to-white border border-gray-100 rounded-lg relative mb-4" | |
> | |
<pre class="break-words leading-1 whitespace-pre-line text-xs md:text-sm text-gray-800"> | |
pip install -U sentence-transformers | |
</pre> | |
</div> | |
</p> | |
<div class="lg:col-span-3"> | |
<p class="mb-4"> | |
The usage is as simple as: | |
</p> | |
<div | |
class="p-4 bg-gradient-to-b from-gray-50-to-white border border-gray-100 rounded-lg relative mb-4" | |
> | |
<pre class="break-words leading-1 whitespace-pre-line text-xs md:text-sm text-gray-800"> | |
from sentence_transformers import SentenceTransformer | |
model = SentenceTransformer('paraphrase-MiniLM-L6-v2') | |
#Sentences we want to encode. Example: | |
sentence = ['This framework generates embeddings for each input sentence'] | |
#Sentences are encoded by calling model.encode() | |
embedding = model.encode(sentence) | |
</pre> | |
</div> | |
</div> | |
</div> | |
<div class="grid lg:grid-cols-3 gap-x-4 gap-y-7"> | |
<div class="lg:col-span-3"> | |
<p class="mb-4"> | |
Hugging Face makes it easy to collaboratively build and showcase your <a | |
href="https://www.sbert.net/">Sentence Transformers</a | |
> | |
models! You can collaborate with your organization, upload and showcase your own models in your profile ❤️ | |
</p> | |
</div> | |
<a href="https://www.sbert.net/" class="block overflow-hidden group"> | |
<div | |
class="w-full h-40 object-cover mb-2 rounded-lg flex items-center justify-center bg-[#FA8072]" | |
> | |
<img alt="" src="https://huggingface.co/spaces/sentence-transformers/README/resolve/main/sbertLogo.png" class="w-40" /> | |
</div> | |
<div class="underline">Documentation</div> | |
</a> | |
<a | |
href="https://github.com/UKPLab/sentence-transformers/blob/master/sentence_transformers/SentenceTransformer.py#L417" | |
class="block overflow-hidden group" | |
> | |
<div | |
class="w-full h-40 mb-2 bg-gray-900 group-hover:bg-gray-850 rounded-lg flex items-start justify-start overflow-hidden" | |
> | |
<img | |
alt="" | |
src="https://huggingface.co/spaces/sentence-transformers/README/resolve/main/push-to-hub.png" | |
class="w-full h-40 object-cover overflow-hidden" | |
/> | |
</div> | |
<div class="underline">Push your Sentence Transformers models to the Hub ❤️ </div> | |
</a> | |
<a | |
href="https://huggingface.co/models?library=sentence-transformers&sort=downloads" | |
class="block overflow-hidden group" | |
> | |
<div | |
class="w-full h-40 mb-2 bg-gray-900 group-hover:bg-gray-850 rounded-lg flex items-start justify-start overflow-hidden" | |
> | |
<img | |
alt="" | |
src="https://huggingface.co/spaces/sentence-transformers/README/resolve/main/sbert-hf.png" | |
class="w-full h-40 object-cover overflow-hidden" | |
/> | |
</div> | |
<div class="underline">Find all Sentence Transformers models on the 🤗 Hub</div> | |
</a> | |
<div class="lg:col-span-3"> | |
<p class="mb-4"> | |
To upload your Sentence Transformers models to the Hugging Face Hub log in with <code class="language-python">huggingface-cli login</code> and then use the <a | |
href="https://github.com/UKPLab/sentence-transformers/blob/master/sentence_transformers/SentenceTransformer.py#L417" | |
>save_to_hub</a | |
> | |
function within the Sentence Transformers library. | |
</p> | |
<div | |
class="p-4 bg-gradient-to-b from-gray-50-to-white border border-gray-100 rounded-lg relative mb-4" | |
> | |
<pre | |
class="break-words leading-1 whitespace-pre-line text-xs md:text-sm text-gray-800"> | |
from sentence_transformers import SentenceTransformer | |
# Load or train a model | |
model = ... | |
# Push to Hub | |
model.save_to_hub("my_new_model") | |
</pre> | |
</div> | |
</p> | |
</div> |