Instructions to use Terrificfantasm/bert-base-cased-conll2003-ner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Terrificfantasm/bert-base-cased-conll2003-ner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="Terrificfantasm/bert-base-cased-conll2003-ner")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("Terrificfantasm/bert-base-cased-conll2003-ner") model = AutoModelForTokenClassification.from_pretrained("Terrificfantasm/bert-base-cased-conll2003-ner", device_map="auto") - Notebooks
- Google Colab
- Kaggle
CoNLL-2003 named entity recognition
Selected method: full_finetuning, epoch 3. The choice was fixed on validation data before test evaluation. This is a measured academic adaptation of BERT, not a production-validated system.
Training data and evaluation
Official 14,041 / 3,250 / 3,453 sentence splits. Exact sentence overlaps retained and audited: train/validation 129, train/test 78, validation/test 25.
Strict IOB2 micro entity F1 using seqeval 1.2.2. Full entity type and boundaries must match.
BERT-base-cased with a linear nine-label BIO head. Supervise only first subtokens; all other positions use -100. No truncation; first-subtoken word argmax, no BIO repair.
The table preserves native scales: AG News, NER and POS metrics are in [0, 1]; QA EM/F1 are in [0, 100]. Training seconds exclude validation, saving and final evaluation.
| method | best_epoch | trainable_parameters | train_seconds | test_precision | test_recall | test_f1 | test_token_accuracy | test_conlleval_f1 | test_invalid_predicted_i_transitions |
|---|---|---|---|---|---|---|---|---|---|
| partial_finetuning | 3 | 14182665 | 145.792294 | 0.890973 | 0.891289 | 0.891131 | 0.978400 | 0.879617 | 182 |
| full_finetuning | 3 | 107726601 | 441.893810 | 0.911310 | 0.918732 | 0.915006 | 0.982944 | 0.910398 | 64 |
Optimization and reproducibility
Three epochs, seed 42. AdamW: head LR 1e-3, trainable encoder LR 2e-5, weight decay 0.01, 10% linear warmup, clipping 1.0. Effective batch size 16. A partial method trains only the last two encoder layers and head; lower layers are frozen in evaluation mode. Frozen weights were checked for invariance. Full fine-tuning updates all parameters.
Base model revision: cd5ef92a9fb2f889e972770a36d4ed042daf221e. Dataset revision: 19edcb426bfd625c275c17b9a99b2239243f4377. Detailed configuration is in training_config.json; the complete comparison is in evaluation.json. The included experiment source and requirements-lock.txt document the original environment. Use a new output directory when reproducing. QA source includes the documented UTF-8 JSON read fix; it did not change any training weights.
Only one seed was evaluated. Small gaps may reflect initialization, dropout and ordering variability; no statistical significance is claimed. Training hardware: RTX 4060 Ti, CUDA bf16. Training runtime is not inference latency.
Intended use and limitations
English news entity tagging for PER, ORG, LOC and MISC.
Small single-seed gap does not establish superiority. Repeated benchmark sentences limit independence. Not validated for Spanish or unseen entity categories.
Loading the delivered model
from transformers import AutoTokenizer, AutoModelForTokenClassification
import torch
repo = 'Terrificfantasm/bert-base-cased-conll2003-ner'
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForTokenClassification.from_pretrained(repo).eval()
words = ['John', 'works', 'in', 'London', '.']
batch = tokenizer(words, is_split_into_words=True, return_tensors='pt')
with torch.no_grad():
ids = model(**batch).logits[0].argmax(-1).tolist()
seen = set()
for i, word_id in enumerate(batch.word_ids()):
if word_id is not None and word_id not in seen:
print(words[word_id], model.config.id2label[ids[i]])
seen.add(word_id)
Use pretokenized words and first-subtoken predictions to match the benchmark. Generic aggregation pipelines may produce different results.
Source terms and references
The upstream BERT checkpoints identify Apache-2.0 licensing. The selected CoNLL dataset distribution does not clearly provide a dataset license on its card. Dataset terms are separate from the base checkpoint license. This repository does not redistribute the training corpus. It preserves upstream attribution without asserting a new blanket license over all data sources.
- Base checkpoint: https://huggingface.co/google-bert/bert-base-cased
- Data source: https://huggingface.co/datasets/lhoestq/conll2003
- Devlin et al., BERT: https://arxiv.org/abs/1810.04805
- Transformers training: https://huggingface.co/docs/transformers/training
- seqeval: https://github.com/chakki-works/seqeval
- Downloads last month
- -
Model tree for Terrificfantasm/bert-base-cased-conll2003-ner
Base model
google-bert/bert-base-cased