File size: 2,219 Bytes
cc6a559
ec30dd8
cc6a559
 
 
 
 
 
 
 
 
2eab1bc
cc6a559
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cdcf888
cc6a559
 
 
 
 
 
 
 
 
 
 
 
 
 
27b6d93
cc6a559
27b6d93
 
 
 
 
 
 
 
 
 
 
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
---
language: it
widget:
- text: "Quando nacque D'Annunzio?"
  context: "D'Annunzio nacque nel 1863"
---

# Italian Bert Base Uncased on Squad-it

## Model description

This model is the uncased base version of the italian BERT (which you may find at `dbmdz/bert-base-italian-uncased`) trained on the question answering task.

#### How to use

```python
from transformers import pipeline

nlp = pipeline('question-answering', model='antoniocappiello/bert-base-italian-uncased-squad-it')

# nlp(context="D'Annunzio nacque nel 1863", question="Quando nacque D'Annunzio?")
# {'score': 0.9990354180335999, 'start': 22, 'end': 25, 'answer': '1863'}
```

## Training data

It has been trained on the question answering task using [SQuAD-it](http://sag.art.uniroma2.it/demo-software/squadit/), derived from the original SQuAD dataset and obtained through the semi-automatic translation of the SQuAD dataset in Italian.

## Training procedure

```bash
python ./examples/run_squad.py \
    --model_type bert \
    --model_name_or_path dbmdz/bert-base-italian-uncased \
    --do_train \
    --do_eval \
    --train_file ./squad_it_uncased/train-v1.1.json \
    --predict_file ./squad_it_uncased/dev-v1.1.json \
    --learning_rate 3e-5 \
    --num_train_epochs 2 \
    --max_seq_length 384 \
    --doc_stride 128 \
    --output_dir ./models/bert-base-italian-uncased-squad-it/ \
    --per_gpu_eval_batch_size=3   \
    --per_gpu_train_batch_size=3   \
    --do_lower_case \
```

## Eval Results

| Metric | # Value   |
| ------ | --------- |
| **EM** | **63.8** |
| **F1** | **75.30** |

## Comparison

| Model                                                                                                                            | EM        | F1 score  |
| -------------------------------------------------------------------------------------------------------------------------------- | --------- | --------- |
| [DrQA-it trained on SQuAD-it](https://github.com/crux82/squad-it/blob/master/README.md#evaluating-a-neural-model-over-squad-it)  | 56.1      | 65.9      |
| This one                                                                                                                         | **63.8** | **75.30** |