Instructions to use Wanjiru/autotrain_gro_ner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Wanjiru/autotrain_gro_ner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="Wanjiru/autotrain_gro_ner")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("Wanjiru/autotrain_gro_ner") model = AutoModelForTokenClassification.from_pretrained("Wanjiru/autotrain_gro_ner", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update readme
Browse files
README.md
CHANGED
|
@@ -1,79 +1,22 @@
|
|
| 1 |
---
|
| 2 |
tags:
|
| 3 |
-
-
|
| 4 |
- token-classification
|
| 5 |
- sequence-tagger-model
|
| 6 |
language: en
|
| 7 |
-
datasets:
|
| 8 |
-
- conll2000
|
| 9 |
widget:
|
| 10 |
-
- text: "
|
| 11 |
---
|
| 12 |
|
| 13 |
-
##
|
| 14 |
|
| 15 |
-
This is the standard phrase chunking model for English that ships with [Flair](https://github.com/flairNLP/flair/).
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
Predicts 4 tags:
|
| 20 |
-
|
| 21 |
-
| **tag** | **meaning** |
|
| 22 |
|---------------------------------|-----------|
|
| 23 |
-
|
|
| 24 |
-
|
|
| 25 |
-
|
|
| 26 |
-
|
|
| 27 |
-
| LST | list marker |
|
| 28 |
-
| NP | noun phrase |
|
| 29 |
-
| PP | prepositional |
|
| 30 |
-
| PRT | particle |
|
| 31 |
-
| SBAR | subordinate clause |
|
| 32 |
-
| VP | verb phrase |
|
| 33 |
-
|
| 34 |
-
Based on [Flair embeddings](https://www.aclweb.org/anthology/C18-1139/) and LSTM-CRF.
|
| 35 |
-
|
| 36 |
-
---
|
| 37 |
-
|
| 38 |
-
### Demo: How to use in Flair
|
| 39 |
-
|
| 40 |
-
Requires: **[Flair](https://github.com/flairNLP/flair/)** (`pip install flair`)
|
| 41 |
-
|
| 42 |
-
```python
|
| 43 |
-
from flair.data import Sentence
|
| 44 |
-
from flair.models import SequenceTagger
|
| 45 |
-
|
| 46 |
-
# load tagger
|
| 47 |
-
tagger = SequenceTagger.load("flair/chunk-english")
|
| 48 |
-
|
| 49 |
-
# make example sentence
|
| 50 |
-
sentence = Sentence("The happy man has been eating at the diner")
|
| 51 |
-
|
| 52 |
-
# predict NER tags
|
| 53 |
-
tagger.predict(sentence)
|
| 54 |
-
|
| 55 |
-
# print sentence
|
| 56 |
-
print(sentence)
|
| 57 |
-
|
| 58 |
-
# print predicted NER spans
|
| 59 |
-
print('The following NER tags are found:')
|
| 60 |
-
# iterate over entities and print
|
| 61 |
-
for entity in sentence.get_spans('np'):
|
| 62 |
-
print(entity)
|
| 63 |
-
|
| 64 |
-
```
|
| 65 |
-
|
| 66 |
-
This yields the following output:
|
| 67 |
-
```
|
| 68 |
-
Span [1,2,3]: "The happy man" [− Labels: NP (0.9958)]
|
| 69 |
-
Span [4,5,6]: "has been eating" [− Labels: VP (0.8759)]
|
| 70 |
-
Span [7]: "at" [− Labels: PP (1.0)]
|
| 71 |
-
Span [8,9]: "the diner" [− Labels: NP (0.9991)]
|
| 72 |
-
|
| 73 |
-
```
|
| 74 |
-
|
| 75 |
-
So, the spans "*The happy man*" and "*the diner*" are labeled as **noun phrases** (NP) and "*has been eating*" is labeled as a **verb phrase** (VP) in the sentence "*The happy man has been eating at the diner*".
|
| 76 |
-
|
| 77 |
|
| 78 |
---
|
| 79 |
|
|
|
|
| 1 |
---
|
| 2 |
tags:
|
| 3 |
+
- bert
|
| 4 |
- token-classification
|
| 5 |
- sequence-tagger-model
|
| 6 |
language: en
|
|
|
|
|
|
|
| 7 |
widget:
|
| 8 |
+
- text: "Total exports of maize"
|
| 9 |
---
|
| 10 |
|
| 11 |
+
## Token Classification
|
| 12 |
|
|
|
|
| 13 |
|
| 14 |
+
| **tag** | **token** |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|---------------------------------|-----------|
|
| 16 |
+
|B-ITEM | BEGINNING ITEM|
|
| 17 |
+
|I-ITEM | INSIDE ITEM|
|
| 18 |
+
|B-METRIC |BEGINNING METRIC |
|
| 19 |
+
|I-METRIC | INSIDE METRIC|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
---
|
| 22 |
|