JohnnyBoy00 commited on
Commit
5bd0810
1 Parent(s): 170b77f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +89 -20
README.md CHANGED
@@ -1,49 +1,73 @@
1
  ---
 
 
 
2
  tags:
3
  - generated_from_trainer
4
- model-index:
5
- - name: mbart-score-finetuned-saf-micro-job
6
- results: []
7
  ---
8
 
9
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
10
- should probably proofread and complete it, then remove this comment. -->
11
-
12
  # mbart-score-finetuned-saf-micro-job
13
 
14
- This model is a fine-tuned version of [facebook/mbart-large-cc25](https://huggingface.co/facebook/mbart-large-cc25) on the None dataset.
15
 
16
  ## Model description
17
 
18
- More information needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  ## Intended uses & limitations
21
 
22
- More information needed
 
 
23
 
24
  ## Training and evaluation data
25
 
26
- More information needed
 
 
 
 
 
 
 
 
 
27
 
28
  ## Training procedure
29
 
 
 
 
 
30
  ### Training hyperparameters
31
 
32
  The following hyperparameters were used during training:
 
 
33
  - learning_rate: 5e-05
 
34
  - train_batch_size: 1
35
- - eval_batch_size: 4
36
- - seed: 42
37
  - gradient_accumulation_steps: 4
38
- - total_train_batch_size: 4
39
- - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
40
- - lr_scheduler_type: linear
41
- - num_epochs: 10
42
  - mixed_precision_training: Native AMP
43
-
44
- ### Training results
45
-
46
-
47
 
48
  ### Framework versions
49
 
@@ -51,3 +75,48 @@ The following hyperparameters were used during training:
51
  - Pytorch 1.13.1+cu116
52
  - Datasets 2.9.0
53
  - Tokenizers 0.13.2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language: de
3
+ datasets:
4
+ - Short-Answer-Feedback/saf_micro_job_german
5
  tags:
6
  - generated_from_trainer
7
+ widget:
8
+ - text: "Antwort: Ich gebe mich zu erkennen und zeige das Informationsschreiben vor Lösung: Der Jobber soll sich in diesem Fall dem Personal gegenüber zu erkennen geben (0.25 P) und das entsprechende Informationsschreiben in der App vorzeigen (0.25 P). Zusätzlich muss notiert werden, zu welchem Zeitpunkt (0.25 P) des Jobs der Jobber enttarnt wurde. Zentrale Frage ist dabei, ob ein neutrales, unvoreingenommenes Verkaufsgespräch stattgefunden hat. Der Job soll mit Erlaubnis der Mitarbeiter bis zum Ende durchgeführt (0.25 P) werden. Frage: Frage 1: Wie reagierst du, wenn du auf deine Tätigkeit angesprochen wirst?"
 
9
  ---
10
 
 
 
 
11
  # mbart-score-finetuned-saf-micro-job
12
 
13
+ This model is a fine-tuned version of [facebook/mbart-large-cc25](https://huggingface.co/facebook/mbart-large-cc25) on the [saf_micro_job_german](https://huggingface.co/datasets/Short-Answer-Feedback/saf_micro_job_german) dataset for Short Answer Feedback (SAF), as proposed in [Filighera et al., ACL 2022](https://aclanthology.org/2022.acl-long.587).
14
 
15
  ## Model description
16
 
17
+ This model was built on top of [mBART](https://arxiv.org/abs/2001.08210), which is a sequence-to-sequence denoising auto-encoder pre-trained on large-scale monolingual corpora in many languages.
18
+
19
+ It expects inputs in the following format:
20
+ ```
21
+ Antwort: [answer] Lösung: [reference_answer] Frage: [question]
22
+ ```
23
+
24
+ In the example above, `[answer]`, `[reference_answer]` and `[question]` should be replaced by the provided answer, the reference answer and the question to which they refer, respectively.
25
+
26
+
27
+ The outputs are formatted as follows:
28
+ ```
29
+ [score] Feedback: [feedback]
30
+ ```
31
+
32
+ Hence, `[score]` will be a numeric value between 0 and 1, while `[feedback]` will be the textual feedback generated by the model according to the given answer.
33
 
34
  ## Intended uses & limitations
35
 
36
+ This model is intended to be used for Short Answer Feedback generation in the context of micro-job training (as conducted on the crowd-worker platform appJobber). Thus, it is not expected to have particularly good performance on sets of questions and answers out of this scope.
37
+
38
+ It is important to acknowledge that the model underperforms when a question that was not seen during training is given as input for inference. In particular, it tends to classify most answers as being correct and does not provide relevant feedback in such cases. Nevertheless, this limitation could be partially overcome by extending the dataset with the desired question (and associated answers) and fine-tuning it for a few epochs on the new data.
39
 
40
  ## Training and evaluation data
41
 
42
+ As mentioned previously, the model was trained on the [saf_micro_job_german](https://huggingface.co/datasets/Short-Answer-Feedback/saf_micro_job_german) dataset, which is divided into the following splits.
43
+
44
+ | Split | Number of examples |
45
+ | --------------------- | ------------------ |
46
+ | train | 1226 |
47
+ | validation | 308 |
48
+ | test_unseen_answers | 271 |
49
+ | test_unseen_questions | 602 |
50
+
51
+ Evaluation was performed on the `test_unseen_answers` and `test_unseen_questions` splits.
52
 
53
  ## Training procedure
54
 
55
+ The [Trainer API](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.Seq2SeqTrainer) was used to fine-tune the model. The code utilized for pre-processing and training was mostly adapted from the [summarization script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization) made available by HuggingFace.
56
+
57
+ Training was completed in a little under 1 hour on a GPU on Google Colab.
58
+
59
  ### Training hyperparameters
60
 
61
  The following hyperparameters were used during training:
62
+ - num_epochs: 10
63
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
64
  - learning_rate: 5e-05
65
+ - lr_scheduler_type: linear
66
  - train_batch_size: 1
 
 
67
  - gradient_accumulation_steps: 4
68
+ - eval_batch_size: 4
 
 
 
69
  - mixed_precision_training: Native AMP
70
+ - PyTorch seed: 42
 
 
 
71
 
72
  ### Framework versions
73
 
 
75
  - Pytorch 1.13.1+cu116
76
  - Datasets 2.9.0
77
  - Tokenizers 0.13.2
78
+
79
+ ## Evaluation results
80
+
81
+ The generated feedback was evaluated through means of the [SacreBLEU](https://huggingface.co/spaces/evaluate-metric/sacrebleu), [ROUGE-2](https://huggingface.co/spaces/evaluate-metric/rouge), [METEOR](https://huggingface.co/spaces/evaluate-metric/meteor), [BERTScore](https://huggingface.co/spaces/evaluate-metric/bertscore) metrics from HuggingFace, while the [Root Mean Squared Error](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.mean_squared_error) loss from scikit-learn was used for evaluation of the predicted scores in relation to the golden label scores.
82
+
83
+ The following results were achieved.
84
+
85
+ | Split | SacreBLEU | ROUGE-2 | METEOR | BERTScore | RMSE |
86
+ | --------------------- | :-------: | :-----: | :----: | :-------: | :---: |
87
+ | test_unseen_answers | 41.6 | 30.9 | 62.0 | 61.2 | 0.333 |
88
+ | test_unseen_questions | 0.7 | 0.7 | 20.3 | 17.8 | 0.465 |
89
+
90
+
91
+ The script used to compute these metrics and perform evaluation can be found in the `evaluation.py` file in this repository.
92
+
93
+ ## Usage
94
+
95
+ The example below shows how the model can be applied to generate feedback to a given answer.
96
+
97
+ ```python
98
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
99
+
100
+ model = AutoModelForSeq2SeqLM.from_pretrained('Short-Answer-Feedback/mbart-score-finetuned-saf-micro-job')
101
+ tokenizer = AutoTokenizer.from_pretrained('Short-Answer-Feedback/mbart-score-finetuned-saf-micro-job')
102
+
103
+ example_input = 'Antwort: Ich gebe mich zu erkennen und zeige das Informationsschreiben vor Lösung: Der Jobber soll sich in diesem Fall dem Personal gegenüber zu erkennen geben (0.25 P) und das entsprechende Informationsschreiben in der App vorzeigen (0.25 P). Zusätzlich muss notiert werden, zu welchem Zeitpunkt (0.25 P) des Jobs der Jobber enttarnt wurde. Zentrale Frage ist dabei, ob ein neutrales, unvoreingenommenes Verkaufsgespräch stattgefunden hat. Der Job soll mit Erlaubnis der Mitarbeiter bis zum Ende durchgeführt (0.25 P) werden. Frage: Frage 1: Wie reagierst du, wenn du auf deine Tätigkeit angesprochen wirst?'
104
+ inputs = tokenizer(example_input, max_length=256, padding='max_length', truncation=True, return_tensors='pt')
105
+
106
+ generated_tokens = model.generate(
107
+ inputs['input_ids'],
108
+ attention_mask=inputs['attention_mask'],
109
+ max_length=128
110
+ )
111
+ output = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[0]
112
+ ```
113
+
114
+ The output produced by the model then looks as follows:
115
+
116
+ ```
117
+ 0.5 Feedback: Sollte das Personal dies gestatten, kannst du den Check auch gerne noch abschließen. Bitte halte nur in fest, wann genau du auf deine Tätigkeit angesprochen wurdest.
118
+ ```
119
+
120
+ ## Related Work
121
+
122
+ [Filighera et al., ACL 2022](https://aclanthology.org/2022.acl-long.587) trained a [mT5 model](https://huggingface.co/docs/transformers/model_doc/mt5) on this dataset, providing a baseline for SAF generation. The entire code used to define and train the model can be found on [GitHub](https://github.com/SebOchs/SAF).