Biencoders - Zero shot text classification
Collection
Biencoders-based architectures for zero-shot multi-label text classification. • 8 items • Updated
Learnable poly-codes with label-conditioned cross-attention.
This model encodes texts and candidate labels into a shared embedding space using BERT, enabling classification into arbitrary categories without retraining for new labels.
| Parameter | Value |
|---|---|
| Base model | bert-base-uncased |
| Model variant | polyencoder |
| Training steps | 1000 |
| Batch size | 2 |
| Learning rate | 2e-05 |
| Trainable params | 109,494,528 |
| Training time | 359.7s |
Trained on polodealvarado/zeroshot-classification.
| Metric | Score |
|---|---|
| Precision | 0.9463 |
| Recall | 0.9677 |
| F1 Score | 0.9569 |
from models.polyencoder import PolyEncoderModel
model = PolyEncoderModel.from_pretrained("polodealvarado/polyencoder")
predictions = model.predict(
texts=["The stock market crashed yesterday."],
labels=[["Finance", "Sports", "Biology", "Economy"]],
)
print(predictions)
# [{"text": "...", "scores": {"Finance": 0.98, "Economy": 0.85, ...}}]
Base model
google-bert/bert-base-uncased