Model

wdtest-a/ptest-ner

import dslim/distilbert-NER@main

wdtest-a committed on October 19, 2026

7a1f9871e604c4bb00997b721ecfa8a7d3d60b21Parent 42dd833Browse files

12 files changed+400 -0

README.md

Added+148 -0
Lines 0 to 0 become lines 1 to 148
@@ -0,0 +1,148 @@
1Added: ---
2Added: license: apache-2.0
3Added: base_model: distilbert-base-cased
4Added: metrics:
5Added: - precision
6Added: - recall
7Added: - f1
8Added: - accuracy
9Added: model-index:
10Added: - name: distilbert-NER
11Added: results: []
12Added: datasets:
13Added: - conll2003
14Added: language:
15Added: - en
16Added: pipeline_tag: token-classification
17Added: ---
18Added: # distilbert-NER
19Added:
20Added: If my open source models have been useful to you, please consider supporting me in building small, useful AI models for everyone (and help me afford med school / help out my parents financially). Thanks!
21Added:
22Added: <a href="https://www.buymeacoffee.com/dslim" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/arial-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
23Added:
24Added: ## Model description
25Added:
26Added: **distilbert-NER** is the fine-tuned version of **DistilBERT**, which is a distilled variant of the BERT model. DistilBERT has fewer parameters than BERT, making it smaller, faster, and more efficient. distilbert-NER is specifically fine-tuned for the task of **Named Entity Recognition (NER)**.
27Added:
28Added: This model accurately identifies the same four types of entities as its BERT counterparts: location (LOC), organizations (ORG), person (PER), and Miscellaneous (MISC). Although it is a more compact model, distilbert-NER demonstrates a robust performance in NER tasks, balancing between size, speed, and accuracy.
29Added:
30Added: The model was fine-tuned on the English version of the [CoNLL-2003 Named Entity Recognition](https://www.aclweb.org/anthology/W03-0419.pdf) dataset, which is widely recognized for its comprehensive and diverse range of entity types.
31Added:
32Added: ### Available NER models
33Added: | Model Name | Description | Parameters |
34Added: |-------------------|-------------|------------------|
35Added: | [distilbert-NER](https://huggingface.co/dslim/distilbert-NER) | Fine-tuned DistilBERT - a smaller, faster, lighter version of BERT | 66M |
36Added: | [bert-large-NER](https://huggingface.co/dslim/bert-large-NER/) | Fine-tuned bert-large-cased - larger model with slightly better performance | 340M |
37Added: | [bert-base-NER](https://huggingface.co/dslim/bert-base-NER)-([uncased](https://huggingface.co/dslim/bert-base-NER-uncased)) | Fine-tuned bert-base, available in both cased and uncased versions | 110M |
38Added:
39Added: ## Intended uses & limitations
40Added:
41Added: #### How to use
42Added:
43Added: This model can be utilized with the Transformers *pipeline* for NER, similar to the BERT models.
44Added:
45Added: ```python
46Added: from transformers import AutoTokenizer, AutoModelForTokenClassification
47Added: from transformers import pipeline
48Added:
49Added: tokenizer = AutoTokenizer.from_pretrained("dslim/distilbert-NER")
50Added: model = AutoModelForTokenClassification.from_pretrained("dslim/distilbert-NER")
51Added:
52Added: nlp = pipeline("ner", model=model, tokenizer=tokenizer)
53Added: example = "My name is Wolfgang and I live in Berlin"
54Added:
55Added: ner_results = nlp(example)
56Added: print(ner_results)
57Added: ```
58Added:
59Added: #### Limitations and bias
60Added:
61Added: The performance of distilbert-NER is linked to its training on the CoNLL-2003 dataset. Therefore, it might show limited effectiveness on text data that significantly differs from this training set. Users should be aware of potential biases inherent in the training data and the possibility of entity misclassification in complex sentences.
62Added:
63Added:
64Added: ## Training data
65Added:
66Added: This model was fine-tuned on English version of the standard [CoNLL-2003 Named Entity Recognition](https://www.aclweb.org/anthology/W03-0419.pdf) dataset.
67Added:
68Added: The training dataset distinguishes between the beginning and continuation of an entity so that if there are back-to-back entities of the same type, the model can output where the second entity begins. As in the dataset, each token will be classified as one of the following classes:
69Added:
70Added: Abbreviation|Description
71Added: -|-
72Added: O|Outside of a named entity
73Added: B-MISC |Beginning of a miscellaneous entity right after another miscellaneous entity
74Added: I-MISC | Miscellaneous entity
75Added: B-PER |Beginning of a person’s name right after another person’s name
76Added: I-PER |Person’s name
77Added: B-ORG |Beginning of an organization right after another organization
78Added: I-ORG |organization
79Added: B-LOC |Beginning of a location right after another location
80Added: I-LOC |Location
81Added:
82Added:
83Added: ### CoNLL-2003 English Dataset Statistics
84Added: This dataset was derived from the Reuters corpus which consists of Reuters news stories. You can read more about how this dataset was created in the CoNLL-2003 paper.
85Added: #### # of training examples per entity type
86Added: Dataset|LOC|MISC|ORG|PER
87Added: -|-|-|-|-
88Added: Train|7140|3438|6321|6600
89Added: Dev|1837|922|1341|1842
90Added: Test|1668|702|1661|1617
91Added: #### # of articles/sentences/tokens per dataset
92Added: Dataset |Articles |Sentences |Tokens
93Added: -|-|-|-
94Added: Train |946 |14,987 |203,621
95Added: Dev |216 |3,466 |51,362
96Added: Test |231 |3,684 |46,435
97Added:
98Added: ## Training procedure
99Added:
100Added: This model was trained on a single NVIDIA V100 GPU with recommended hyperparameters from the [original BERT paper](https://arxiv.org/pdf/1810.04805) which trained & evaluated the model on CoNLL-2003 NER task.
101Added:
102Added: ## Eval results
103Added: | Metric | Score |
104Added: |------------|-------|
105Added: | Loss | 0.0710|
106Added: | Precision | 0.9202|
107Added: | Recall | 0.9232|
108Added: | F1 | 0.9217|
109Added: | Accuracy | 0.9810|
110Added:
111Added: The training and validation losses demonstrate a decrease over epochs, signaling effective learning. The precision, recall, and F1 scores are competitive, showcasing the model's robustness in NER tasks.
112Added:
113Added: ### BibTeX entry and citation info
114Added:
115Added: For DistilBERT:
116Added:
117Added: ```
118Added: @article{sanh2019distilbert,
119Added: title={DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter},
120Added: author={Sanh, Victor and Debut, Lysandre and Chaumond, Julien and Wolf, Thomas},
121Added: journal={arXiv preprint arXiv:1910.01108},
122Added: year={2019}
123Added: }
124Added: ```
125Added:
126Added: For the underlying BERT model:
127Added:
128Added: ```
129Added: @article{DBLP:journals/corr/abs-1810-04805,
130Added: author = {Jacob Devlin and
131Added: Ming{-}Wei Chang and
132Added: Kenton Lee and
133Added: Kristina Toutanova},
134Added: title = {{BERT:} Pre-training of Deep Bidirectional Transformers for Language
135Added: Understanding},
136Added: journal = {CoRR},
137Added: volume = {abs/1810.04805},
138Added: year = {2018},
139Added: url = {http://arxiv.org/abs/1810.04805},
140Added: archivePrefix = {arXiv},
141Added: eprint = {1810.04805},
142Added: timestamp = {Tue, 30 Oct 2018 20:39:56 +0100},
143Added: biburl = {https://dblp.org/rec/journals/corr/abs-1810-04805.bib},
144Added: bibsource = {db
145Added:
146Added: lp computer science bibliography, https://dblp.org}
147Added: }
148Added: ```(no newline at end of file)

config.json

Added+47 -0
Lines 0 to 0 become lines 1 to 47
@@ -0,0 +1,47 @@
1Added: {
2Added: "_name_or_path": "distilbert-base-cased",
3Added: "activation": "gelu",
4Added: "architectures": [
5Added: "DistilBertForTokenClassification"
6Added: ],
7Added: "attention_dropout": 0.1,
8Added: "dim": 768,
9Added: "dropout": 0.1,
10Added: "hidden_dim": 3072,
11Added: "id2label": {
12Added: "0": "O",
13Added: "1": "B-PER",
14Added: "2": "I-PER",
15Added: "3": "B-ORG",
16Added: "4": "I-ORG",
17Added: "5": "B-LOC",
18Added: "6": "I-LOC",
19Added: "7": "B-MISC",
20Added: "8": "I-MISC"
21Added: },
22Added: "initializer_range": 0.02,
23Added: "label2id": {
24Added: "O": 0,
25Added: "B-PER": 1,
26Added: "I-PER": 2,
27Added: "B-ORG": 3,
28Added: "I-ORG": 4,
29Added: "B-LOC": 5,
30Added: "I-LOC": 6,
31Added: "B-MISC": 7,
32Added: "I-MISC": 8
33Added: },
34Added: "max_position_embeddings": 512,
35Added: "model_type": "distilbert",
36Added: "n_heads": 12,
37Added: "n_layers": 6,
38Added: "output_past": true,
39Added: "pad_token_id": 0,
40Added: "qa_dropout": 0.1,
41Added: "seq_classif_dropout": 0.2,
42Added: "sinusoidal_pos_embds": false,
43Added: "tie_weights_": true,
44Added: "torch_dtype": "float32",
45Added: "transformers_version": "4.35.2",
46Added: "vocab_size": 28996
47Added: }

model.safetensors

Added

Large (LFS-tracked) file content changed — 249 MB

onnx/config.json

Added+47 -0
Lines 0 to 0 become lines 1 to 47
@@ -0,0 +1,47 @@
1Added: {
2Added: "_name_or_path": "dslim/distilbert-NER",
3Added: "activation": "gelu",
4Added: "architectures": [
5Added: "DistilBertForTokenClassification"
6Added: ],
7Added: "attention_dropout": 0.1,
8Added: "dim": 768,
9Added: "dropout": 0.1,
10Added: "hidden_dim": 3072,
11Added: "id2label": {
12Added: "0": "O",
13Added: "1": "B-PER",
14Added: "2": "I-PER",
15Added: "3": "B-ORG",
16Added: "4": "I-ORG",
17Added: "5": "B-LOC",
18Added: "6": "I-LOC",
19Added: "7": "B-MISC",
20Added: "8": "I-MISC"
21Added: },
22Added: "initializer_range": 0.02,
23Added: "label2id": {
24Added: "O": 0,
25Added: "B-PER": 1,
26Added: "I-PER": 2,
27Added: "B-ORG": 3,
28Added: "I-ORG": 4,
29Added: "B-LOC": 5,
30Added: "I-LOC": 6,
31Added: "B-MISC": 7,
32Added: "I-MISC": 8
33Added: },
34Added: "max_position_embeddings": 512,
35Added: "model_type": "distilbert",
36Added: "n_heads": 12,
37Added: "n_layers": 6,
38Added: "output_past": true,
39Added: "pad_token_id": 0,
40Added: "qa_dropout": 0.1,
41Added: "seq_classif_dropout": 0.2,
42Added: "sinusoidal_pos_embds": false,
43Added: "tie_weights_": true,
44Added: "torch_dtype": "float32",
45Added: "transformers_version": "4.36.2",
46Added: "vocab_size": 28996
47Added: }

onnx/special_tokens_map.json

Added+37 -0
Lines 0 to 0 become lines 1 to 37
@@ -0,0 +1,37 @@
1Added: {
2Added: "cls_token": {
3Added: "content": "[CLS]",
4Added: "lstrip": false,
5Added: "normalized": false,
6Added: "rstrip": false,
7Added: "single_word": false
8Added: },
9Added: "mask_token": {
10Added: "content": "[MASK]",
11Added: "lstrip": false,
12Added: "normalized": false,
13Added: "rstrip": false,
14Added: "single_word": false
15Added: },
16Added: "pad_token": {
17Added: "content": "[PAD]",
18Added: "lstrip": false,
19Added: "normalized": false,
20Added: "rstrip": false,
21Added: "single_word": false
22Added: },
23Added: "sep_token": {
24Added: "content": "[SEP]",
25Added: "lstrip": false,
26Added: "normalized": false,
27Added: "rstrip": false,
28Added: "single_word": false
29Added: },
30Added: "unk_token": {
31Added: "content": "[UNK]",
32Added: "lstrip": false,
33Added: "normalized": false,
34Added: "rstrip": false,
35Added: "single_word": false
36Added: }
37Added: }

onnx/tokenizer.json

Added

This file is too large to display.

onnx/tokenizer_config.json

Added+59 -0
Lines 0 to 0 become lines 1 to 59
@@ -0,0 +1,59 @@
1Added: {
2Added: "added_tokens_decoder": {
3Added: "0": {
4Added: "content": "[PAD]",
5Added: "lstrip": false,
6Added: "normalized": false,
7Added: "rstrip": false,
8Added: "single_word": false,
9Added: "special": true
10Added: },
11Added: "100": {
12Added: "content": "[UNK]",
13Added: "lstrip": false,
14Added: "normalized": false,
15Added: "rstrip": false,
16Added: "single_word": false,
17Added: "special": true
18Added: },
19Added: "101": {
20Added: "content": "[CLS]",
21Added: "lstrip": false,
22Added: "normalized": false,
23Added: "rstrip": false,
24Added: "single_word": false,
25Added: "special": true
26Added: },
27Added: "102": {
28Added: "content": "[SEP]",
29Added: "lstrip": false,
30Added: "normalized": false,
31Added: "rstrip": false,
32Added: "single_word": false,
33Added: "special": true
34Added: },
35Added: "103": {
36Added: "content": "[MASK]",
37Added: "lstrip": false,
38Added: "normalized": false,
39Added: "rstrip": false,
40Added: "single_word": false,
41Added: "special": true
42Added: }
43Added: },
44Added: "clean_up_tokenization_spaces": true,
45Added: "cls_token": "[CLS]",
46Added: "do_lower_case": false,
47Added: "mask_token": "[MASK]",
48Added: "max_length": 512,
49Added: "model_max_length": 512,
50Added: "pad_token": "[PAD]",
51Added: "sep_token": "[SEP]",
52Added: "stride": 0,
53Added: "strip_accents": null,
54Added: "tokenize_chinese_chars": true,
55Added: "tokenizer_class": "DistilBertTokenizer",
56Added: "truncation_side": "right",
57Added: "truncation_strategy": "longest_first",
58Added: "unk_token": "[UNK]"
59Added: }

onnx/vocab.txt

Added

This file is too large to display.

special_tokens_map.json

Added+7 -0
Lines 0 to 0 become lines 1 to 7
@@ -0,0 +1,7 @@
1Added: {
2Added: "cls_token": "[CLS]",
3Added: "mask_token": "[MASK]",
4Added: "pad_token": "[PAD]",
5Added: "sep_token": "[SEP]",
6Added: "unk_token": "[UNK]"
7Added: }

tokenizer.json

Added

This file is too large to display.

tokenizer_config.json

Added+55 -0
Lines 0 to 0 become lines 1 to 55
@@ -0,0 +1,55 @@
1Added: {
2Added: "added_tokens_decoder": {
3Added: "0": {
4Added: "content": "[PAD]",
5Added: "lstrip": false,
6Added: "normalized": false,
7Added: "rstrip": false,
8Added: "single_word": false,
9Added: "special": true
10Added: },
11Added: "100": {
12Added: "content": "[UNK]",
13Added: "lstrip": false,
14Added: "normalized": false,
15Added: "rstrip": false,
16Added: "single_word": false,
17Added: "special": true
18Added: },
19Added: "101": {
20Added: "content": "[CLS]",
21Added: "lstrip": false,
22Added: "normalized": false,
23Added: "rstrip": false,
24Added: "single_word": false,
25Added: "special": true
26Added: },
27Added: "102": {
28Added: "content": "[SEP]",
29Added: "lstrip": false,
30Added: "normalized": false,
31Added: "rstrip": false,
32Added: "single_word": false,
33Added: "special": true
34Added: },
35Added: "103": {
36Added: "content": "[MASK]",
37Added: "lstrip": false,
38Added: "normalized": false,
39Added: "rstrip": false,
40Added: "single_word": false,
41Added: "special": true
42Added: }
43Added: },
44Added: "clean_up_tokenization_spaces": true,
45Added: "cls_token": "[CLS]",
46Added: "do_lower_case": false,
47Added: "mask_token": "[MASK]",
48Added: "model_max_length": 512,
49Added: "pad_token": "[PAD]",
50Added: "sep_token": "[SEP]",
51Added: "strip_accents": null,
52Added: "tokenize_chinese_chars": true,
53Added: "tokenizer_class": "DistilBertTokenizer",
54Added: "unk_token": "[UNK]"
55Added: }

vocab.txt

Added

This file is too large to display.