Instructions to use Salesforce/SFR-Embedding-Code-400M_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-400M_R with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Salesforce/SFR-Embedding-Code-400M_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-400M_R with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="Salesforce/SFR-Embedding-Code-400M_R", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Salesforce/SFR-Embedding-Code-400M_R", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Add pipeline tag, library name and link to paper
This PR improves the model card by adding the pipeline_tag so that the model can be found in the search at https://huggingface.co/models?pipeline_tag=feature-extraction.
It also adds the correct library_name. Finally, a link to the paper has been added for easier discovery of the paper the model is associated with.
Perhaps adding sentence-transformers as a tag also makes sense, so this model pops up when filtering for either transformers or sentence-transformers? Should help with discoverability, especially as lots of people rely on https://huggingface.co/models?library=sentence-transformers for finding embedding models.
I also think adding code as a tag could be useful.
- Tom Aarsen