Feature Extraction
sentence-transformers
Safetensors
Transformers
codexembed2b
code
retrieval
custom_code
Instructions to use Salesforce/SFR-Embedding-Code-2B_R with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Salesforce/SFR-Embedding-Code-2B_R with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Salesforce/SFR-Embedding-Code-2B_R", trust_remote_code=True) sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Transformers
How to use Salesforce/SFR-Embedding-Code-2B_R with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="Salesforce/SFR-Embedding-Code-2B_R", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Salesforce/SFR-Embedding-Code-2B_R", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Add library_name and pipeline_tag tags
#5
by nielsr HF Staff - opened
This PR ensures a button will appear regarding "how to use" at the top right.
As a heads up, this model does not require Apologies, I didn't realise this used the custom GTE implementation.trust_remote_code=True in the Sentence Transformers script.
I think we should also add transformers to the metadata tags.