Zero-Shot Text Classification — spanclass

GLiNER-inspired span-attentive classification with top-K span selection.

This model encodes texts and candidate labels into a shared embedding space using BERT, enabling classification into arbitrary categories without retraining for new labels.

Training Details

Parameter Value
Base model bert-base-uncased
Model variant spanclass
Training steps 1000
Batch size 2
Learning rate 2e-05
Trainable params 111,254,017
Training time 374.1s

Dataset

Trained on polodealvarado/zeroshot-classification.

Evaluation Results

Metric Score
Precision 0.9277
Recall 0.9503
F1 Score 0.9388

Usage

from models.spanclass import SpanClassModel

model = SpanClassModel.from_pretrained("polodealvarado/spanclass")

predictions = model.predict(
    texts=["The stock market crashed yesterday."],
    labels=[["Finance", "Sports", "Biology", "Economy"]],
)
print(predictions)
# [{"text": "...", "scores": {"Finance": 0.98, "Economy": 0.85, ...}}]
Downloads last month
42
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for polodealvarado/spanclass

Finetuned
(6425)
this model

Dataset used to train polodealvarado/spanclass

Collection including polodealvarado/spanclass