Update README.md
Browse files
README.md
CHANGED
@@ -72,34 +72,22 @@ Below is an example of how to use the model with the Hugging Face Transformers l
|
|
72 |
```python
|
73 |
from transformers import pipeline
|
74 |
|
75 |
-
ner = pipeline("token-classification", model="IsmaelMousa/modernbert-ner-conll2003", aggregation_strategy="
|
76 |
|
77 |
-
ner("Hi, I'm Ismael Mousa from Palestine working for NVIDIA inc.")
|
|
|
|
|
|
|
|
|
|
|
78 |
```
|
79 |
|
80 |
Results:
|
81 |
|
82 |
```
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
'start': 7,
|
87 |
-
'end': 10},
|
88 |
-
{'entity_group': 'PER',
|
89 |
-
'score': 0.90173304,
|
90 |
-
'word': 'mael Mousa',
|
91 |
-
'start': 10,
|
92 |
-
'end': 20},
|
93 |
-
{'entity_group': 'LOC',
|
94 |
-
'score': 0.992393,
|
95 |
-
'word': ' Palestine',
|
96 |
-
'start': 25,
|
97 |
-
'end': 35},
|
98 |
-
{'entity_group': 'ORG',
|
99 |
-
'score': 0.75373423,
|
100 |
-
'word': ' NVIDIA inc',
|
101 |
-
'start': 47,
|
102 |
-
'end': 58}]
|
103 |
```
|
104 |
|
105 |
### Training hyperparameters
|
|
|
72 |
```python
|
73 |
from transformers import pipeline
|
74 |
|
75 |
+
ner = pipeline(task="token-classification", model="IsmaelMousa/modernbert-ner-conll2003", aggregation_strategy="max")
|
76 |
|
77 |
+
results = ner("Hi, I'm Ismael Mousa from Palestine working for NVIDIA inc.")
|
78 |
+
|
79 |
+
for entity in results:
|
80 |
+
for key, value in entity.items():
|
81 |
+
if key == "entity_group":
|
82 |
+
print(f"{entity['word']} => {entity[key]}")
|
83 |
```
|
84 |
|
85 |
Results:
|
86 |
|
87 |
```
|
88 |
+
Ismael Mousa => PER
|
89 |
+
Palestine => LOC
|
90 |
+
NVIDIA => ORG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
```
|
92 |
|
93 |
### Training hyperparameters
|