Downloads · 30 days
12.3K
11% of all-time downloads
chopratejas/technique-router
technique-router is a text classification model from chopratejas. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
A fine-tuned MiniLM classifier that routes image queries to optimal compression techniques for the Headroom SDK.
Downloads · 30 days
12.3K
11% of all-time downloads
All-time downloads
117K
Public
Parameters
33.4M
133 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors133 MB · 99%
From the Hugging Face model README
A fine-tuned MiniLM classifier that routes image queries to optimal compression techniques for the Headroom SDK.
This model classifies natural language queries about images into one of four optimization techniques:
| Technique | Token Savings | Best For |
|---|---|---|
transcode | ~99% | Text extraction, OCR tasks |
crop | 50-90% | Region-specific queries |
full_low | ~87% | General understanding |
preserve | 0% | Fine details, counting |
| Class | Precision | Recall | F1-Score |
|---|---|---|---|
| transcode | 0.95 | 0.92 | 0.93 |
| crop | 0.92 | 0.97 | 0.94 |
| preserve | 0.97 | 0.90 | 0.93 |
| full_low | 0.89 | 0.96 | 0.92 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model
model_id = "chopratejas/technique-router"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
model.eval()
# Classify a query
query = "What brand is the TV?"
inputs = tokenizer(query, return_tensors="pt", truncation=True, padding=True)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=-1)
pred_id = torch.argmax(probs, dim=-1).item()
confidence = probs[0][pred_id].item()
technique = model.config.id2label[pred_id]
print(f"{query} -> {technique} ({confidence:.0%})")
# Output: What brand is the TV? -> preserve (73%)
from headroom.image import TrainedRouter
router = TrainedRouter()
decision = router.classify(image_bytes, "What brand is the TV?")
print(decision.technique) # Technique.PRESERVE
This model is designed for:
@misc{headroom-technique-router,
title={Technique Router for Image Token Optimization},
author={Headroom AI},
year={2025},
publisher={Hugging Face},
url={https://huggingface.co/chopratejas/technique-router}
}