π BERT Token Classification β Important Chunk Extractor (ONNX) - InTextIQ
This model identifies and extracts important parts of input sentences using BERT-based token classification, exported to the ONNX format for optimized inference.
π§ Use Case
This model is designed for context engineering β to extract semantically important words or chunks from sentences or chat messages, enabling better personalization in downstream applications like AI assistants or dialogue systems.
Example:
Input: Iβll be unavailable tomorrow due to a team offsite.
Output: [unavailable, tomorrow, team offsite]
π οΈ Model Details
Architecture: BERT (
bert-base-uncased) fine-tuned for token classificationExported to: ONNX for efficient runtime inference via Optimum
Labels:
label_list = ["O", "B-IMPORTANT", "I-IMPORTANT"]
π¦ How to Use (with π€ Transformers + Optimum)
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForTokenClassification
import torch
model = ORTModelForTokenClassification.from_pretrained("madhavgohel/bert-token-onnx", file_name="model.onnx")
tokenizer = AutoTokenizer.from_pretrained("madhavgohel/bert-token-onnx")
text = "I'm a software engineer with 5 years experience looking to switch to a data science role."
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
predictions = torch.argmax(outputs.logits, dim=-1)
tokens = tokenizer.convert_ids_to_tokens(inputs["input_ids"][0])
important_tokens = [tok for tok, label in zip(tokens, predictions[0]) if label == 1]
print("Important tokens:", important_tokens)
π Files Included
| File | Purpose |
|---|---|
model.onnx |
Exported ONNX model |
config.json |
Model config |
tokenizer_config.json |
Tokenizer config |
vocab.txt |
Vocabulary for BERT tokenizer |
special_tokens_map.json |
Tokenization map for special tokens |
README.md |
Model usage documentation |
- Downloads last month
- 42
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support
Model tree for madhavgohel/bert-token-onnx
Base model
google-bert/bert-base-uncased