BOINC AI Hub
  • 🌍BOINC AI Hub
  • 🌍Repositories
  • Getting Started with Repositories
  • Repository Settings
  • Pull Requests & Discussions
  • Notifications
  • Collections
  • 🌍Webhooks
    • How-to: Automatic fine-tuning with Auto-Train
    • How-to: Build a Discussion bot based on BLOOM
    • How-to: Create automatic metadata quality reports
  • Repository size recommendations
  • Next Steps
  • Licenses
  • 🌍Models
  • The Model Hub
  • 🌍Model Cards
    • Annotated Model Card
    • Carbon Emissions
    • Model Card Guidebook
    • Landscape Analysis
  • Gated Models
  • Uploading Models
  • Downloading Models
  • 🌍Integrated Libraries
    • Adapter Transformers
    • AllenNLP
    • Asteroid
    • Diffusers
    • ESPnet
    • fastai
    • Flair
    • Keras
    • ML-Agents
    • PaddleNLP
    • RL-Baselines3-Zoo
    • Sample Factory
    • Sentence Transformers
    • spaCy
    • SpanMarker
    • SpeechBrain
    • Stable-Baselines3
    • Stanza
    • TensorBoard
    • timm
    • Transformers
    • Transformers.js
  • 🌍Model Widgets
    • Widget Examples
  • Inference API docs
  • Frequently Asked Questions
  • 🌍Advanced Topics
    • Integrate a library with the Hub
    • Tasks
  • 🌍Datasets
  • Datasets Overview
  • Dataset Cards
  • Gated Datasets
  • Dataset Viewer
  • Using Datasets
  • Adding New Datasets
  • 🌍Spaces
  • 🌍Spaces Overview
    • Handling Spaces Dependencies
    • Spaces Settings
    • Using Spaces for Organization Cards
  • Spaces GPU Upgrades
  • Spaces Persistent Storage
  • Gradio Spaces
  • Streamlit Spaces
  • Static HTML Spaces
  • 🌍Docker Spaces
    • Your first Docker Spaces
    • Example Docker Spaces
    • Argilla on Spaces
    • Label Studio on Spaces
    • Aim on Space
    • Livebook on Spaces
    • Shiny on Spaces
    • ZenML on Spaces
    • Panel on Spaces
    • ChatUI on Spaces
    • Tabby on Spaces
  • Embed your Space
  • Run Spaces with Docker
  • Spaces Configuration Reference
  • Sign-In with BA button
  • Spaces Changelog
  • 🌍Advanced Topics
    • Using OpenCV in Spaces
    • More ways to create Spaces
    • Managing Spaces with Github Actions
    • Custom Python Spaces
    • How to Add a Space to ArXiv
    • Cookie limitations in Spaces
  • 🌍Other
  • 🌍Organizations
    • Managing Organizations
    • Organization Cards
    • Access Control in Organizations
  • Billing
  • 🌍Security
    • User Access Tokens
    • Git over SSH
    • Signing Commits with GPG
    • Single Sign-On (SSO)
    • Malware Scanning
    • Pickle Scanning
    • Secrets Scanning
  • Moderation
  • Paper Pages
  • Search
  • Digital Object Identifier (DOI)
  • Hub API Endpoints
  • Sign-In with BA
Powered by GitBook
On this page
  • Using Sentence Transformers at BOINC AI
  • Exploring sentence-transformers in the Hub
  • Using existing models
  • Sharing your models
  • Additional resources
  1. Integrated Libraries

Sentence Transformers

PreviousSample FactoryNextspaCy

Last updated 1 year ago

Using Sentence Transformers at BOINC AI

sentence-transformers is a library that provides easy methods to compute embeddings (dense vector representations) for sentences, paragraphs and images. Texts are embedded in a vector space such that similar text is close, which enables applications such as semantic search, clustering, and retrieval.

Exploring sentence-transformers in the Hub

You can find over 500 hundred sentence-transformer models by filtering at the left of the . Most of these models support different tasks, such as doing to generate the embedding, and as a way to determine how similar is a given sentence to other. You can also find an overview of the official pre-trained models in .

All models on the Hub come up with features:

  1. An automatically generated model card with a description, example code snippets, architecture overview, and more.

  2. Metadata tags that help for discoverability and contain information such as license.

  3. An interactive widget you can use to play out with the model directly in the browser.

  4. An Inference API that allows to make inference requests.

Using existing models

The pre-trained models on the Hub can be loaded with a single line of code

Copied

from sentence_transformers import SentenceTransformer
model = SentenceTransformer('model_name')

Here is an example that encodes sentences and then computes the distance between them for doing semantic search.

Copied

from sentence_transformers import SentenceTransformer, util
model = SentenceTransformer('multi-qa-MiniLM-L6-cos-v1')

query_embedding = model.encode('How big is London')
passage_embedding = model.encode(['London has 9,787,426 inhabitants at the 2011 census',
                                  'London is known for its finacial district'])

print("Similarity:", util.dot_score(query_embedding, passage_embedding))

If you want to see how to load a specific model, you can click Use in sentence-transformers and you will be given a working snippet that you can load it!

Sharing your models

You can share your Sentence Transformers by using the save_to_hub method from a trained model.

Copied

from sentence_transformers import SentenceTransformer

# Load or train a model
model.save_to_hub("my_new_model")

Additional resources

This command creates a repository with an automatically generated model card, an inference widget, example code snippets, and more! is an example.

Sentence Transformers .

Sentence Transformers .

Integration with Hub .

🌍
Here
library
docs
announcement
models page
feature-extraction
sentence-similarity
the official docs