metadata
base_model:
- google-bert/bert-base-uncased
π BERT Token Classification β Important Chunk Extractor (ONNX)
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:
0: Not Important1: 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("your-username/bert-token-onnx")
text = "The server will go down at midnight for maintenance."
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 |