Text Classification
Transformers
ONNX
Safetensors
English
distilbert
intent-classification
multitask
iab
conversational-ai
adtech
calibrated-confidence
text-embeddings-inference
Instructions to use admesh/agentic-intent-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use admesh/agentic-intent-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="admesh/agentic-intent-classifier")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("admesh/agentic-intent-classifier", dtype="auto") - Notebooks
- Google Colab
- Kaggle
| from __future__ import annotations | |
| from dataclasses import dataclass | |
| import torch | |
| from torch import nn | |
| from transformers import AutoModel | |
| class MultiTaskLabelSizes: | |
| intent_type: int | |
| intent_subtype: int | |
| decision_phase: int | |
| class MultiTaskIntentModel(nn.Module): | |
| def __init__(self, base_model_name: str, label_sizes: MultiTaskLabelSizes): | |
| super().__init__() | |
| self.base_model_name = base_model_name | |
| self.encoder = AutoModel.from_pretrained(base_model_name) | |
| hidden_size = int(self.encoder.config.hidden_size) | |
| self.dropout = nn.Dropout(float(getattr(self.encoder.config, "seq_classif_dropout", 0.2))) | |
| self.intent_type_head = nn.Linear(hidden_size, label_sizes.intent_type) | |
| self.intent_subtype_head = nn.Linear(hidden_size, label_sizes.intent_subtype) | |
| self.decision_phase_head = nn.Linear(hidden_size, label_sizes.decision_phase) | |
| def forward(self, input_ids: torch.Tensor, attention_mask: torch.Tensor) -> dict[str, torch.Tensor]: | |
| outputs = self.encoder(input_ids=input_ids, attention_mask=attention_mask) | |
| pooled = outputs.last_hidden_state[:, 0] | |
| pooled = self.dropout(pooled) | |
| return { | |
| "intent_type_logits": self.intent_type_head(pooled), | |
| "intent_subtype_logits": self.intent_subtype_head(pooled), | |
| "decision_phase_logits": self.decision_phase_head(pooled), | |
| } | |