File size: 4,216 Bytes
00334cb
 
cbf3687
 
b48399f
cbf3687
 
 
b48399f
 
 
00334cb
 
cbf3687
 
 
 
 
b48399f
e66022e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4844eff
e66022e
cbf3687
 
 
 
00334cb
cbf3687
 
 
 
 
 
 
 
 
 
 
00334cb
e66022e
 
 
 
 
 
 
 
4844eff
cbf3687
00334cb
cbf3687
 
 
 
 
 
 
 
 
 
 
 
 
 
00334cb
 
cbf3687
00334cb
cbf3687
 
 
e66022e
 
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
---
tags:
- generated_from_trainer
datasets:
- DFKI-SLT/few-nerd
model-index:
- name: span-marker-robert-base
  results: []
license: apache-2.0
language:
- en
---

<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

# span-marker-robert-base

This model is a fine-tuned version of [roberta-base](https://huggingface.co/roberta-base) on [few-nerd](https://huggingface.co/datasets/DFKI-SLT/few-nerd) dataset using [SpanMarker](https://github.com/tomaarsen/SpanMarkerNER) an module for NER.

# Usage

```python
test_query= [
    "The 2022 FIFA World Cup was the 22nd FIFA World Cup, the quadrennial world championship for national football teams organized by FIFA.",
    "Argentina were crowned the champions after winning the final against the title holder France 4-2 on penalties following a 3-3 draw after extra time.", 
    "It was Argentina's third title and their first since 1986, as well being the first nation from outside of Europe to win the tournament since 2002.", 
    "French player Kylian Mbappé became the first player to score a hat-trick in a World Cup final since Geoff Hurst in the 1966 final and won the Golden Boot as he scored the most goals (eight) during the tournament.", 
    "Argentine captain Lionel Messi was voted the tournament's best player, winning the Golden Ball. Teammates Emiliano Martínez and Enzo Fernández won the Golden Glove, awarded to the tournament's best goalkeeper, and the Young Player Award, awarded to the tournament's best young player."
]
entities_per_query = model.predict(test_query)

for entities in entities_per_query:
    for entity in entities:
        print(entity["span"], "-->", entity["label"])
```

## Training and evaluation data

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 5e-05
- train_batch_size: 4
- eval_batch_size: 4
- seed: 42
- gradient_accumulation_steps: 2
- total_train_batch_size: 8
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.1
- num_epochs: 1

### Evaluation

It achieves the following results on the evaluation set:
- Loss: 0.0214
- Overall Precision: 0.7642
- Overall Recall: 0.7947
- Overall F1: 0.7791
- Overall Accuracy: 0.9397
  
### Training results

| Training Loss | Epoch | Step | Validation Loss | Overall Precision | Overall Recall | Overall F1 | Overall Accuracy |
|:-------------:|:-----:|:----:|:---------------:|:-----------------:|:--------------:|:----------:|:----------------:|
| 0.0214        | 0.08  | 100  | 0.0219          | 0.7641            | 0.7679         | 0.7660     | 0.9330           |
| 0.0199        | 0.16  | 200  | 0.0243          | 0.7442            | 0.7679         | 0.7559     | 0.9348           |
| 0.0179        | 0.24  | 300  | 0.0212          | 0.7730            | 0.7580         | 0.7654     | 0.9361           |
| 0.0188        | 0.33  | 400  | 0.0225          | 0.7616            | 0.7710         | 0.7662     | 0.9343           |
| 0.0149        | 0.41  | 500  | 0.0240          | 0.7537            | 0.7783         | 0.7658     | 0.9375           |
| 0.015         | 0.49  | 600  | 0.0230          | 0.7540            | 0.7829         | 0.7682     | 0.9362           |
| 0.0137        | 0.57  | 700  | 0.0232          | 0.7746            | 0.7538         | 0.7640     | 0.9319           |
| 0.0123        | 0.65  | 800  | 0.0218          | 0.7651            | 0.7879         | 0.7763     | 0.9393           |
| 0.0103        | 0.73  | 900  | 0.0223          | 0.7688            | 0.7964         | 0.7824     | 0.9397           |
| 0.0108        | 0.82  | 1000 | 0.0209          | 0.7763            | 0.7816         | 0.7789     | 0.9397           |
| 0.0116        | 0.9   | 1100 | 0.0213          | 0.7743            | 0.7879         | 0.7811     | 0.9398           |
| 0.0119        | 0.98  | 1200 | 0.0214          | 0.7653            | 0.7947         | 0.7797     | 0.9400           |


### Framework versions

- Transformers 4.30.2
- Pytorch 2.0.1+cu118
- Datasets 2.13.1
- Tokenizers 0.13.3
- span-marker 1.2.3