File size: 10,204 Bytes
83e24e5
a40ab9f
83e24e5
a40ab9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83e24e5
 
a40ab9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83e24e5
 
a40ab9f
83e24e5
a40ab9f
 
 
 
83e24e5
 
a40ab9f
 
83e24e5
a40ab9f
83e24e5
a40ab9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83e24e5
a40ab9f
 
83e24e5
a40ab9f
 
83e24e5
a40ab9f
 
83e24e5
a40ab9f
 
83e24e5
a40ab9f
 
83e24e5
a40ab9f
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
---
library_name: span-marker
tags:
- span-marker
- token-classification
- ner
- named-entity-recognition
- generated_from_span_marker_trainer
datasets:
- imvladikon/nemo_corpus
metrics:
- precision
- recall
- f1
widget:
- text: אחר כך הצטרף ל דאלאס מאווריקס מ ה אנ.בי.איי ו חזר לשחק ב אירופה ב ספרד ב מדי
    קאחה בילבאו ו חירונה
- text: ב קיץ 1982 ניסה טל ברודי (אז עוזר ה מאמן) להחתימו, אבל בריאנט, ש סבתו יהודיה,
    חתם אז ב פורד קאנטו ו זכה עמ היא ב אותה עונה ב גביע אירופה ל אלופות.
- text: יו"ר ועדת ה נוער נתן סלובטיק אמר ש ה שחקנים של אנחנו לא משתלבים ב אירופה.
- text: ב ה סגל ש יתכנס מחר אחר ה צהריים ל מחנה אימונים ב שפיים 17 שחקנים, כולל מוזמן
    חדש שירן אדירי מ מכבי תל אביב.
- text: 'תוצאות אחרות: טורינו 2 (מורלו עצמי, מולר) לצה 0; קאליארי 0 לאציו 1 (פסטה,
    שער עצמי); פיורנטינה 2 (נאפי, פאציונה) גנואה 2 (אורלאנדו, שקוראווי).'
pipeline_tag: token-classification
model-index:
- name: SpanMarker
  results:
  - task:
      type: token-classification
      name: Named Entity Recognition
    dataset:
      name: Unknown
      type: imvladikon/nemo_corpus
      split: test
    metrics:
    - type: f1
      value: 0.7338129496402878
      name: F1
    - type: precision
      value: 0.7577142857142857
      name: Precision
    - type: recall
      value: 0.7113733905579399
      name: Recall
---

# SpanMarker

This is a [SpanMarker](https://github.com/tomaarsen/SpanMarkerNER) model trained on the [imvladikon/nemo_corpus](https://huggingface.co/datasets/imvladikon/nemo_corpus) dataset that can be used for Named Entity Recognition.

## Model Details

### Model Description
- **Model Type:** SpanMarker
<!-- - **Encoder:** [Unknown](https://huggingface.co/unknown) -->
- **Maximum Sequence Length:** 512 tokens
- **Maximum Entity Length:** 100 words
- **Training Dataset:** [imvladikon/nemo_corpus](https://huggingface.co/datasets/imvladikon/nemo_corpus)
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->

### Model Sources

- **Repository:** [SpanMarker on GitHub](https://github.com/tomaarsen/SpanMarkerNER)
- **Thesis:** [SpanMarker For Named Entity Recognition](https://raw.githubusercontent.com/tomaarsen/SpanMarkerNER/main/thesis.pdf)

### Model Labels
| Label | Examples                                        |
|:------|:------------------------------------------------|
| ANG   | "יידיש", "גרמנית", "אנגלית"                     |
| DUC   | "דינמיט", "סובארו", "מרצדס"                     |
| EVE   | "מצדה", "הצהרת בלפור", "ה שואה"                 |
| FAC   | "ברזילי", "כלא עזה", "תל - ה שומר"              |
| GPE   | "ה שטחים", "שפרעם", "רצועת עזה"                 |
| LOC   | "שייח רדואן", "גיבאליה", "חאן יונס"             |
| ORG   | "כך", "ה ארץ", "מרחב ה גליל"                    |
| PER   | "רמי רהב", "נימר חוסיין", "איברהים נימר חוסיין" |
| WOA   | "קיטש ו מוות", "קדיש", "ה ארץ"                  |

## Evaluation

### Metrics
| Label   | Precision | Recall | F1     |
|:--------|:----------|:-------|:-------|
| **all** | 0.7577    | 0.7114 | 0.7338 |
| ANG     | 0.0       | 0.0    | 0.0    |
| DUC     | 0.0       | 0.0    | 0.0    |
| FAC     | 0.0       | 0.0    | 0.0    |
| GPE     | 0.7085    | 0.8103 | 0.7560 |
| LOC     | 0.5714    | 0.1951 | 0.2909 |
| ORG     | 0.7460    | 0.6912 | 0.7176 |
| PER     | 0.8301    | 0.8052 | 0.8175 |
| WOA     | 0.0       | 0.0    | 0.0    |

## Uses

### Direct Use for Inference

```python
from span_marker import SpanMarkerModel

# Download from the 🤗 Hub
model = SpanMarkerModel.from_pretrained("span_marker_model_id")
# Run inference
entities = model.predict("יו\"ר ועדת ה נוער נתן סלובטיק אמר ש ה שחקנים של אנחנו לא משתלבים ב אירופה.")
```

### Downstream Use
You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

```python
from span_marker import SpanMarkerModel, Trainer

# Download from the 🤗 Hub
model = SpanMarkerModel.from_pretrained("span_marker_model_id")

# Specify a Dataset with "tokens" and "ner_tag" columns
dataset = load_dataset("conll2003") # For example CoNLL2003

# Initialize a Trainer using the pretrained model & dataset
trainer = Trainer(
    model=model,
    train_dataset=dataset["train"],
    eval_dataset=dataset["validation"],
)
trainer.train()
trainer.save_model("span_marker_model_id-finetuned")
```
</details>

<!--
### Out-of-Scope Use

*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->

<!--
## Bias, Risks and Limitations

*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
-->

<!--
### Recommendations

*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
-->

## Training Details

### Training Set Metrics
| Training set          | Min | Median  | Max |
|:----------------------|:----|:--------|:----|
| Sentence length       | 1   | 25.4427 | 117 |
| Entities per sentence | 0   | 1.2472  | 20  |

### Training Hyperparameters
- learning_rate: 1e-05
- train_batch_size: 2
- eval_batch_size: 2
- seed: 42
- gradient_accumulation_steps: 2
- total_train_batch_size: 4
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.1
- num_epochs: 4
- mixed_precision_training: Native AMP

### Training Results
| Epoch  | Step | Validation Loss | Validation Precision | Validation Recall | Validation F1 | Validation Accuracy |
|:------:|:----:|:---------------:|:--------------------:|:-----------------:|:-------------:|:-------------------:|
| 0.4070 | 1000 | 0.0352          | 0.0                  | 0.0               | 0.0           | 0.8980              |
| 0.8140 | 2000 | 0.0327          | 0.0                  | 0.0               | 0.0           | 0.8980              |
| 1.2210 | 3000 | 0.0224          | 0.0                  | 0.0               | 0.0           | 0.8980              |
| 1.6280 | 4000 | 0.0149          | 0.5874               | 0.2200            | 0.3201        | 0.9134              |
| 2.0350 | 5000 | 0.0137          | 0.55                 | 0.3895            | 0.4560        | 0.9248              |
| 2.4420 | 6000 | 0.0113          | 0.6204               | 0.4313            | 0.5089        | 0.9298              |
| 2.8490 | 7000 | 0.0121          | 0.5733               | 0.5075            | 0.5384        | 0.9310              |
| 3.2560 | 8000 | 0.0115          | 0.5782               | 0.5236            | 0.5495        | 0.9334              |
| 3.6630 | 9000 | 0.0108          | 0.6100               | 0.5354            | 0.5703        | 0.9359              |
| 0.4070 | 1000 | 0.0103          | 0.6321               | 0.5880            | 0.6092        | 0.9381              |
| 0.8140 | 2000 | 0.0088          | 0.6968               | 0.6288            | 0.6610        | 0.9471              |
| 1.2210 | 3000 | 0.0091          | 0.6790               | 0.6695            | 0.6742        | 0.9484              |
| 1.6280 | 4000 | 0.0086          | 0.6845               | 0.6845            | 0.6845        | 0.9480              |
| 2.0350 | 5000 | 0.0089          | 0.6802               | 0.6845            | 0.6824        | 0.9492              |
| 2.4420 | 6000 | 0.0084          | 0.6938               | 0.6953            | 0.6945        | 0.9539              |
| 2.8490 | 7000 | 0.0088          | 0.6884               | 0.7039            | 0.6960        | 0.9512              |
| 3.2560 | 8000 | 0.0086          | 0.6895               | 0.7124            | 0.7008        | 0.9514              |
| 3.6630 | 9000 | 0.0082          | 0.6989               | 0.7049            | 0.7019        | 0.9526              |
| 0.4070 | 1000 | 0.0080          | 0.7109               | 0.7124            | 0.7117        | 0.9535              |
| 0.8140 | 2000 | 0.0074          | 0.7577               | 0.7114            | 0.7338        | 0.9567              |
| 1.2210 | 3000 | 0.0083          | 0.7183               | 0.7414            | 0.7297        | 0.9554              |
| 1.6280 | 4000 | 0.0088          | 0.6987               | 0.7339            | 0.7159        | 0.9510              |
| 2.0350 | 5000 | 0.0086          | 0.7135               | 0.7296            | 0.7215        | 0.9541              |
| 2.4420 | 6000 | 0.0086          | 0.7167               | 0.7382            | 0.7273        | 0.9559              |
| 2.8490 | 7000 | 0.0088          | 0.7133               | 0.7554            | 0.7337        | 0.9541              |
| 3.2560 | 8000 | 0.0085          | 0.7165               | 0.7511            | 0.7334        | 0.9551              |
| 3.6630 | 9000 | 0.0083          | 0.7263               | 0.7489            | 0.7375        | 0.9561              |

### Framework Versions
- Python: 3.10.12
- SpanMarker: 1.5.0
- Transformers: 4.35.2
- PyTorch: 2.1.0+cu118
- Datasets: 2.15.0
- Tokenizers: 0.15.0

## Citation

### BibTeX
```
@software{Aarsen_SpanMarker,
    author = {Aarsen, Tom},
    license = {Apache-2.0},
    title = {{SpanMarker for Named Entity Recognition}},
    url = {https://github.com/tomaarsen/SpanMarkerNER}
}
```

<!--
## Glossary

*Clearly define terms in order to be accessible across audiences.*
-->

<!--
## Model Card Authors

*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->

<!--
## Model Card Contact

*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->