Sentence Similarity
sentence-transformers
Safetensors
qwen3
feature-extraction
agent-skill-retrieval
text-embeddings-inference
Instructions to use tencent/R3-embedding-0.6b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use tencent/R3-embedding-0.6b with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("tencent/R3-embedding-0.6b") 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] - Notebooks
- Google Colab
- Kaggle
Expand code snippet for easier use
#1
by tomaarsen HF Staff - opened
Hello @xiaoxiaoshadiao and team,
First of all, congratulations on the release! I'm a big fan of using the retrieve & rerank pipeline for finding the correct skills to use, so it's nice to see more progress here.
I wanted to make it even easier for users to understand how to use it, so I updated the README here. It also removes trust_remote_code=True, as that's actually not even necessary!
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("tencent/R3-embedding-0.6b")
query_embedding = model.encode_query("I need to compose music")
document_embeddings = model.encode_document([ # The format is "name | description | skill_md"
"music-composer | Composes original music | Creates music for various media formats ...",
"music-lyricist | Writes lyrics for songs | Creates lyrics for various music genres ...",
"music-editor | Edits and mixes music tracks | Provides audio editing and mixing services ...",
])
similarities = model.similarity(query_embedding, document_embeddings)
print(similarities)
# tensor([[0.7410, 0.5510, 0.5028]])
With the output similarity it's immediately clear that it works as expected.
- Tom Aarsen
tomaarsen changed pull request status to open
xiaoxiaoshadiao changed pull request status to merged
Thank you for the pr, which has made our README clearer.