Feature Extraction
sentence-transformers
Safetensors
English
bert
sentence-similarity
retrieval
tool-use
llm-agent
r-language
text-embeddings-inference
Run this model with HF Jobs
Run Stephen-SMJ/DARE-R-Retriever on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Stephen-SMJ/DARE-R-Retriever. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Stephen-SMJ/DARE-R-Retriever on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Stephen-SMJ/DARE-R-Retriever with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Stephen-SMJ/DARE-R-Retriever with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Stephen-SMJ/DARE-R-Retriever") 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] - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files23 unmodified lines242526272829305 unmodified lines36373839404142434445464748495051525354555657585960616263646523 unmodified lines- **Task:** Dense Retrieval for Tool-Augmented LLMs- **Performance**: SoTA on R package retrieval tasks.- **Domain:** R programming language, Data Science, Statistical Analysis functions- **Max Sequence Length:** 256 tokens<!-- ## 💡 Why DARE? (The Input Formatting)Unlike traditional semantic search models that only take a natural language query, DARE is trained to be **distribution-conditional**. It expects a concatenated input of the user's intent AND the data profile (e.g., high-dimensional, sparse, categorical). -->5 unmodified linespip install -U sentence-transformers```Then, you can load the model and compute embeddings:```from sentence_transformers import SentenceTransformerfrom sentence_transformers.util import cos_sim# 1. Load the DARE modelmodel = SentenceTransformer("Stephen-SMJ/DARE-MiniLM-L6-v2")# 2. Define the exact input format: Query + Data Profilequery = "I want to perform PCA to reduce dimensions."data_profile = "{ 'data_modality': 'tabular', 'dimensionality': 'high', 'distribution': 'sparse matrix' }"# ⚠️ Crucial Step: Concatenate them!x_q = f"{query} {data_profile}"# 3. Formulate the Document/Function format: Data Constraints + Function Descriptiondoc = """Data Constraints: {"data_modality": "tabular", "dimensionality": "high", "distribution_assumption": "sparse"}. Task: dimensionality_reduction.R Package: sparsepca. Function: spca(). Description: Calculates sparse principal components for high-dimensional and sparse datasets."""# 4. Compute embeddingsquery_emb = model.encode(x_q)doc_emb = model.encode(doc)# 5. Compute cosine similaritysimilarity = cos_sim(query_emb, doc_emb)print(f"Similarity Score: {similarity.item():.4f}")```23 unmodified lines2425262728295 unmodified lines353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838423 unmodified lines- **Task:** Dense Retrieval for Tool-Augmented LLMs- **Performance**: SoTA on R package retrieval tasks.- **Domain:** R programming language, Data Science, Statistical Analysis functions<!-- ## 💡 Why DARE? (The Input Formatting)Unlike traditional semantic search models that only take a natural language query, DARE is trained to be **distribution-conditional**. It expects a concatenated input of the user's intent AND the data profile (e.g., high-dimensional, sparse, categorical). -->5 unmodified linespip install -U sentence-transformers```### Usage by our RPKB (Optional and Recommended)```pythonfrom huggingface_hub import snapshot_downloadimport chromadb# 1. Download the database folder from Hugging Facedb_path = snapshot_download(repo_id="Stephen-SMJ/RPKB",repo_type="dataset",allow_patterns="RPKB/*" # Adjust this if your folder name is different)# 2. Connect to the local ChromaDB instanceclient = chromadb.PersistentClient(path=f"{db_path}/RPKB")# 3. Access the specific collectioncollection = client.get_collection(name="inference")print(f"✅ Loaded {collection.count()} R functions ready for conditional retrieval!")```### Then, you can load the DARE model do retrieval:```pythonfrom sentence_transformers import SentenceTransformerfrom sentence_transformers.util import cos_sim# 1. Load the DARE modelmodel = SentenceTransformer("Stephen-SMJ/DARE-R-Retrieval")# 2. Define the exact input format: Query + Data Profilequery = "I have a high-dimensional genomic dataset named hidra_ex_1_2000.csv in my environment. I need to identify driver elements by estimating regulatory scores based on the counts providedin the data. Please set the random seed to 123 at the start. I need to filter for fragment lengths between 150 and 600 bp and use a DNA count filter of 5. For my evaluation, please print thefirst value of the estimated scores (est_a) for the very first region identified."# 3. Generate embeddingquery_embedding = model.encode(user_query).tolist()# 4. Search in the database with Hard Filtersresults = collection.query(query_embeddings=[query_embedding],n_results=3,include=["metadatas", "distances", "documents"])# Display Top-1 Resultprint("Top-1 Function:", results["metadatas"][0][0]["package_name"], "::", results["metadatas"][0][0]["function_name"])```
README.md+36-17