Text Classification
Transformers
Safetensors
PEFT
English
retrievalrouter
feature-extraction
retrieval
document-retrieval
information-retrieval
routing
RAG
query-routing
late-interaction
lora
custom_code
Instructions to use emrekuruu/RetrievalRouter-lambda-l30 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use emrekuruu/RetrievalRouter-lambda-l30 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="emrekuruu/RetrievalRouter-lambda-l30", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("emrekuruu/RetrievalRouter-lambda-l30", trust_remote_code=True, device_map="auto") - PEFT
How to use emrekuruu/RetrievalRouter-lambda-l30 with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Rename custom code to RetrievalRouter
Browse files
configuration_retrievalrouter.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""RetrievalRouter Configuration."""
|
| 2 |
+
from transformers import PretrainedConfig
|
| 3 |
+
|
| 4 |
+
# Standalone copy of train.config.ARM_NAMES: this module is uploaded to the Hub and loaded
|
| 5 |
+
# via trust_remote_code, so it cannot import from the training package.
|
| 6 |
+
STRATEGY_NAMES = ["MULTIMODAL_RERANK", "MULTIMODAL-SINGLE", "TEXT_RERANK", "TEXT-SINGLE", "BM25"]
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class RetrievalRouterConfig(PretrainedConfig):
|
| 10 |
+
"""Configuration for RetrievalRouter - a query-aware retrieval router."""
|
| 11 |
+
model_type = "retrievalrouter"
|
| 12 |
+
|
| 13 |
+
def __init__(
|
| 14 |
+
self,
|
| 15 |
+
base_model_name: str = "Qwen/Qwen3-0.6B-Base",
|
| 16 |
+
hidden_size: int = 1024,
|
| 17 |
+
num_labels: int = 5,
|
| 18 |
+
classifier_dropout: float = 0.1,
|
| 19 |
+
strategy_names: list = None,
|
| 20 |
+
**kwargs,
|
| 21 |
+
):
|
| 22 |
+
super().__init__(num_labels=num_labels, **kwargs)
|
| 23 |
+
self.base_model_name = base_model_name
|
| 24 |
+
self.hidden_size = hidden_size
|
| 25 |
+
self.classifier_dropout = classifier_dropout
|
| 26 |
+
self.strategy_names = strategy_names or STRATEGY_NAMES
|