added how the model can be imported
Browse files
README.md
CHANGED
|
@@ -32,7 +32,19 @@ This token-classification model aims to perform Named Entity Recognition on Ger
|
|
| 32 |
|
| 33 |
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 34 |
- Named Entity Recignition
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 38 |
|
|
|
|
| 32 |
|
| 33 |
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 34 |
- Named Entity Recignition
|
| 35 |
+
### Direct Use
|
| 36 |
+
|
| 37 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
|
| 38 |
+
|
| 39 |
+
model = AutoModelForTokenClassification.from_pretrained("demigrigo/mpr_bert_german_ner")
|
| 40 |
+
tokenizer = AutoTokenizer.from_pretrained("demigrigo/mpr_bert_german_ner")
|
| 41 |
+
|
| 42 |
+
nlp = pipeline("token-classification", model=model, tokenizer=tokenizer, aggregation_strategy="average")
|
| 43 |
+
|
| 44 |
+
text = "Ernennung FML. Peter Zaninis zum Kriegsminister" **example sentence**
|
| 45 |
+
print(nlp(text))
|
| 46 |
+
|
| 47 |
+
|
| 48 |
|
| 49 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 50 |
|