Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
inference: false
|
| 5 |
+
pipeline_tag: token-classification
|
| 6 |
+
tags:
|
| 7 |
+
- ner
|
| 8 |
+
- bert
|
| 9 |
+
license: mit
|
| 10 |
+
datasets:
|
| 11 |
+
- conll2003
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# ONNX version of dslim/bert-base-NER
|
| 15 |
+
|
| 16 |
+
**This model is a conversion of [dslim/bert-base-NER](https://huggingface.co/dslim/bert-base-NER) to ONNX** format using the [🤗 Optimum](https://huggingface.co/docs/optimum/index) library.
|
| 17 |
+
|
| 18 |
+
`bert-base-NER` is a fine-tuned BERT model that is ready to use for Named Entity Recognition and achieves state-of-the-art performance for the NER task. It has been trained to recognize four types of entities: location (LOC), organizations (ORG), person (PER) and Miscellaneous (MISC).
|
| 19 |
+
|
| 20 |
+
Specifically, this model is a `bert-base-cased` model that was fine-tuned on the English version of the standard `CoNLL-2003 Named Entity Recognition` dataset.
|
| 21 |
+
|
| 22 |
+
## Usage
|
| 23 |
+
|
| 24 |
+
Loading the model requires the [🤗 Optimum](https://huggingface.co/docs/optimum/index) library installed.
|
| 25 |
+
|
| 26 |
+
```python
|
| 27 |
+
from optimum.onnxruntime import ORTModelForTokenClassification
|
| 28 |
+
from transformers import AutoTokenizer, pipeline
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
tokenizer = AutoTokenizer.from_pretrained("laiyer/bert-base-NER-onnx")
|
| 32 |
+
model = ORTModelForTokenClassification.from_pretrained("laiyer/bert-base-NER-onnx")
|
| 33 |
+
ner = pipeline(
|
| 34 |
+
task="ner",
|
| 35 |
+
model=model,
|
| 36 |
+
tokenizer=tokenizer,
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
ner_output = ner("My name is John Doe.")
|
| 40 |
+
print(ner_output)
|
| 41 |
+
```
|