Model

wdtest-a/ptest-ner

Blame for README.md at 7a1f987

Line blame for README.md
LineCommitAuthorDateCode
1import dslim/distilbert-NER@main7a1f987wdtest-a---
2license: apache-2.0
3base_model: distilbert-base-cased
4metrics:
5- precision
6- recall
7- f1
8- accuracy
9model-index:
10- name: distilbert-NER
11 results: []
12datasets:
13- conll2003
14language:
15- en
16pipeline_tag: token-classification
17---
18# distilbert-NER
19
20If 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!
21
22<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>
23
24## Model description
25
26**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)**.
27
28This 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.
29
30The 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.
31
32### Available NER models
33| Model Name | Description | Parameters |
34|-------------------|-------------|------------------|
35| [distilbert-NER](https://huggingface.co/dslim/distilbert-NER) | Fine-tuned DistilBERT - a smaller, faster, lighter version of BERT | 66M |
36| [bert-large-NER](https://huggingface.co/dslim/bert-large-NER/) | Fine-tuned bert-large-cased - larger model with slightly better performance | 340M |
37| [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 |
38
39## Intended uses & limitations
40
41#### How to use
42
43This model can be utilized with the Transformers *pipeline* for NER, similar to the BERT models.
44
45```python
46from transformers import AutoTokenizer, AutoModelForTokenClassification
47from transformers import pipeline
48
49tokenizer = AutoTokenizer.from_pretrained("dslim/distilbert-NER")
50model = AutoModelForTokenClassification.from_pretrained("dslim/distilbert-NER")
51
52nlp = pipeline("ner", model=model, tokenizer=tokenizer)
53example = "My name is Wolfgang and I live in Berlin"
54
55ner_results = nlp(example)
56print(ner_results)
57```
58
59#### Limitations and bias
60
61The 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.
62
63
64## Training data
65
66This model was fine-tuned on English version of the standard [CoNLL-2003 Named Entity Recognition](https://www.aclweb.org/anthology/W03-0419.pdf) dataset.
67
68The 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:
69
70Abbreviation|Description
71-|-
72O|Outside of a named entity
73B-MISC |Beginning of a miscellaneous entity right after another miscellaneous entity
74I-MISC | Miscellaneous entity
75B-PER |Beginning of a person’s name right after another person’s name
76I-PER |Person’s name
77B-ORG |Beginning of an organization right after another organization
78I-ORG |organization
79B-LOC |Beginning of a location right after another location
80I-LOC |Location
81
82
83### CoNLL-2003 English Dataset Statistics
84This 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.
85#### # of training examples per entity type
86Dataset|LOC|MISC|ORG|PER
87-|-|-|-|-
88Train|7140|3438|6321|6600
89Dev|1837|922|1341|1842
90Test|1668|702|1661|1617
91#### # of articles/sentences/tokens per dataset
92Dataset |Articles |Sentences |Tokens
93-|-|-|-
94Train |946 |14,987 |203,621
95Dev |216 |3,466 |51,362
96Test |231 |3,684 |46,435
97
98## Training procedure
99
100This 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.
101
102## Eval results
103| Metric | Score |
104|------------|-------|
105| Loss | 0.0710|
106| Precision | 0.9202|
107| Recall | 0.9232|
108| F1 | 0.9217|
109| Accuracy | 0.9810|
110
111The 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.
112
113### BibTeX entry and citation info
114
115For DistilBERT:
116
117```
118@article{sanh2019distilbert,
119 title={DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter},
120 author={Sanh, Victor and Debut, Lysandre and Chaumond, Julien and Wolf, Thomas},
121 journal={arXiv preprint arXiv:1910.01108},
122 year={2019}
123}
124```
125
126For the underlying BERT model:
127
128```
129@article{DBLP:journals/corr/abs-1810-04805,
130 author = {Jacob Devlin and
131 Ming{-}Wei Chang and
132 Kenton Lee and
133 Kristina Toutanova},
134 title = {{BERT:} Pre-training of Deep Bidirectional Transformers for Language
135 Understanding},
136 journal = {CoRR},
137 volume = {abs/1810.04805},
138 year = {2018},
139 url = {http://arxiv.org/abs/1810.04805},
140 archivePrefix = {arXiv},
141 eprint = {1810.04805},
142 timestamp = {Tue, 30 Oct 2018 20:39:56 +0100},
143 biburl = {https://dblp.org/rec/journals/corr/abs-1810-04805.bib},
144 bibsource = {db
145
146lp computer science bibliography, https://dblp.org}
147}
148```