Souvikbasur/roberta-crf-news-ner

RoBERTa-base + CRF layer, fine-tuned for 17-category NER on a custom news dataset. Companion model to Souvikbasur/roberta-base-news-ner โ€” same data/split, CRF decoding added on top.

Not a plug-and-play AutoModel checkpoint โ€” this is a custom architecture. Load it with:

import json, torch, importlib.util
from transformers import AutoTokenizer
from huggingface_hub import hf_hub_download

REPO_ID = "Souvikbasur/roberta-crf-news-ner"
modeling_path = hf_hub_download(REPO_ID, "modeling_roberta_crf.py")
weights_path = hf_hub_download(REPO_ID, "roberta_crf_ner.pt")
config_path = hf_hub_download(REPO_ID, "config.json")

spec = importlib.util.spec_from_file_location("modeling_roberta_crf", modeling_path)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)

with open(config_path) as f:
    cfg = json.load(f)
id2label = {int(k): v for k, v in cfg["id2label"].items()}

tokenizer = AutoTokenizer.from_pretrained(REPO_ID, add_prefix_space=True)
model = mod.RobertaCRFForNER(cfg["base_model"], num_labels=cfg["num_labels"])
model.load_state_dict(torch.load(weights_path, map_location="cpu"))
model.eval()

Entity types (17)

PER, ORG, LOC, FAC, DATE, TIME, EVT, PROD, MONEY, PCT, LAW, NORP, LANG, WOA, QTY, ORD, CARD

Held-out test set performance

precision    recall  f1-score   support

        CARD     0.8533    0.9266    0.8884       477
        DATE     0.8503    0.8982    0.8736       904
         EVT     0.7889    0.7634    0.7760        93
         FAC     0.5970    0.6250    0.6107        64
        LANG     0.8333    0.9615    0.8929        26
         LAW     0.6667    0.7941    0.7248        68
         LOC     0.9472    0.9436    0.9454      1312
       MONEY     0.9182    0.9099    0.9140       222
        NORP     0.9305    0.9357    0.9331       544
         ORD     0.8321    0.9561    0.8898       114
         ORG     0.8378    0.8596    0.8485      1424
         PCT     0.9156    0.9276    0.9216       152
         PER     0.9333    0.9603    0.9466      1108
        PROD     0.8121    0.8013    0.8067       151
         QTY     0.7113    0.6832    0.6970       101
        TIME     0.7590    0.7975    0.7778        79
         WOA     0.5933    0.6544    0.6224       136

   micro avg     0.8737    0.8994    0.8863      6975
   macro avg     0.8106    0.8469    0.8276      6975
weighted avg     0.8750    0.8994    0.8868      6975

Requirements

pip install torch transformers pytorch-crf huggingface_hub
Downloads last month
100
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support