Instructions to use roskosmos19/Coral-Router with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use roskosmos19/Coral-Router with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-classification", model="roskosmos19/Coral-Router")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("roskosmos19/Coral-Router") model = AutoModelForSequenceClassification.from_pretrained("roskosmos19/Coral-Router", device_map="auto") - Notebooks
- Google Colab
- Kaggle
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("roskosmos19/Coral-Router")
model = AutoModelForSequenceClassification.from_pretrained("roskosmos19/Coral-Router", device_map="auto")Coral-Router
Korrektur / Correction (2026-11-23)
DE: Die Gewichte sind Byte für Byte identisch mit facebook/bart-large-mnli (MIT-Lizenz). Das Fine-Tuning auf MultiNLI stammt von Facebook AI, nicht aus diesem Repo.
EN: The weights are byte-identical to facebook/bart-large-mnli (MIT license). The MultiNLI fine-tuning was done by Facebook AI, not in this repo.
Coral-Router is a high-quality zero-shot classification model based on BART-large, fine-tuned on MultiNLI.
It delivers strong performance for zero-shot and few-shot text classification without any task-specific training.
What it is good at
- Zero-shot text classification
- Multi-label classification
- Natural Language Inference (NLI)
- Topic detection, sentiment, intent, content moderation, and many other classification tasks
Just provide the text and a list of candidate labels — the model ranks them by how well they fit.
Model Details
| Property | Value |
|---|---|
| Architecture | BART-large |
| Task | Sequence Classification (NLI) |
| Labels | contradiction / neutral / entailment |
| Max Sequence Length | 1024 |
| Vocabulary Size | 50,265 |
| License | MIT |
Quick Start
Using the Pipeline (recommended)
from transformers import pipeline
classifier = pipeline(
"zero-shot-classification",
model="roskosmos19/Coral-Router"
)
sequence = "One day I will see the world"
candidate_labels = ["travel", "cooking", "dancing"]
result = classifier(sequence, candidate_labels)
print(result)
Multi-label mode
result = classifier(
sequence,
candidate_labels=["travel", "cooking", "dancing", "exploration"],
multi_label=True
)
Manual usage
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
model = AutoModelForSequenceClassification.from_pretrained("roskosmos19/Coral-Router")
tokenizer = AutoTokenizer.from_pretrained("roskosmos19/Coral-Router")
premise = "One day I will see the world"
label = "travel"
hypothesis = f"This example is {label}."
inputs = tokenizer(premise, hypothesis, return_tensors="pt", truncation=True)
with torch.no_grad():
logits = model(**inputs).logits
# Take only contradiction (0) and entailment (2)
probs = torch.softmax(logits[:, [0, 2]], dim=1)
prob_label_is_true = probs[0, 1].item()
print(f"Probability that the text is about '{label}': {prob_label_is_true:.4f}")
How Zero-Shot Classification works
The model treats the input text as a premise and turns each candidate label into a hypothesis of the form:
"This example is {label}."
It then uses the entailment probability as the score for that label. This simple trick works surprisingly well across many domains.
Tips for best results
- Use clear and specific labels
- Prefer multi_label=True when several labels can be true at the same time
- For short texts the model is usually very accurate
- For very long texts, keep the most important part near the beginning (truncation keeps the start)
Limitations
- English only.
- Results depend strongly on how candidate labels are worded.
- Inputs longer than 1024 tokens are truncated.
- Scores are not calibrated probabilities.
- May reflect biases from MultiNLI and BART pre-training data.
- No own evaluation was run for this repo; see facebook/bart-large-mnli.
License
MIT
Credits
Based on the excellent facebook/bart-large-mnli model.
- Downloads last month
- 37
Model tree for roskosmos19/Coral-Router
Base model
facebook/bart-large-mnli
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-classification", model="roskosmos19/Coral-Router")