DhruvMevada3's picture
Export 7-class Universal BERT from best_model.pt with production ReLU architecture
39272b1 verified
|
Raw
History Blame Contribute Delete
1.58 kB
---
language: en
license: other
tags:
- text-classification
- bert
- insurance
- universal
- kinetic
- riskguru
pipeline_tag: text-classification
library_name: transformers
---
# BERT 7-Class Universal Page Classifier
Fine-tuned BERT model for classifying insurance document pages (Universal / Kinetic / RG / Wrap 7-class model).
Used for document-type signals when OpenAI classification is unavailable (e.g. Kinetic fallback) and for page routing in RG/Wrap pipelines.
## Labels
| ID | Label |
|----|-------|
| 0 | acord |
| 1 | contract |
| 2 | declaration |
| 3 | endorsements |
| 4 | forms |
| 5 | others |
| 6 | rating |
## Usage (RunPod / Foundry / any HF runtime)
```python
import os
import torch
from transformers import AutoTokenizer, AutoModel
repo = "injala/bert-universal-classifier-7class"
token = os.environ.get("HF_TOKEN")
tokenizer = AutoTokenizer.from_pretrained(repo, token=token)
model = AutoModel.from_pretrained(repo, token=token, trust_remote_code=True)
model.eval()
text = "ACORD 25 CERTIFICATE OF LIABILITY INSURANCE ..."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
logits = model(**inputs)["logits"]
probs = torch.softmax(logits, dim=-1)
pred_id = probs.argmax(dim=-1).item()
label = model.config.id2label[str(pred_id)]
```
**Note:** Input should be full OCR page text (up to 512 tokens), not short snippets. Production uses ReLU on classifier logits (matches legacy `BERT_Model` inference).
## Source
Exported from `injala/rg_berts_21classes_7classes/best_model.pt`.