giotvr commited on
Commit
4421ef6
1 Parent(s): 9c81fdd

Updates model card

Browse files

Signed-off-by: Giovani <giovanitavares@outlook.com>

Files changed (1) hide show
  1. README.md +25 -23
README.md CHANGED
@@ -14,9 +14,9 @@ tags:
14
 
15
  <!-- Provide a quick summary of what the model is/does. -->
16
 
17
- This is a **[XLM-RoBERTa-base](https://huggingface.co/xlm-roberta-base) fine-tuned model** on 6.5K (premise, hypothesis) sentence pairs from
18
- the **ASSIN2 (Avaliação de Similaridade Semântica e Inferência Textual)** corpus. The original references are:
19
- [Unsupervised Cross-Lingual Representation Learning At Scale](https://arxiv.org/pdf/1911.02116), [ASSIN2: Avaliação de Similaridade Semântica e Inferência Textual](https://huggingface.co/datasets/assin), respectivelly. This model is suitable for Brazilian Portuguese.
20
 
21
  ## Model Details
22
 
@@ -44,7 +44,7 @@ the **ASSIN2 (Avaliação de Similaridade Semântica e Inferência Textual)** co
44
 
45
  ### Direct Use
46
 
47
- This fine-tuned version of [XLM-RoBERTa-base](https://huggingface.co/xlm-roberta-base) performs Natural
48
  Language Inference (NLI), which is a text classification task.
49
 
50
  <!-- <div id="assin_function">
@@ -64,7 +64,7 @@ $$
64
 
65
  The *(premise, hypothesis)* entailment definition used is the same as the one found in Salvatore's paper [1].
66
 
67
- Therefore, this fine-tuned version of [XLM-RoBERTa-base](https://huggingface.co/xlm-roberta-base) classifies pairs of sentences in the form *(premise, hypothesis)* into the classes *ENTAILMENT* or *NONE*.
68
 
69
  <!-- ## Bias, Risks, and Limitations
70
 
@@ -77,7 +77,7 @@ Therefore, this fine-tuned version of [XLM-RoBERTa-base](https://huggingface.co/
77
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
78
  import torch
79
 
80
- model_path = "giotvr/xlm_roberta_base_assin2_fine_tuned"
81
  premise = "As mudanças climáticas são uma ameaça séria para a biodiversidade do planeta."
82
  hypothesis ="A biodiversidade do planeta é seriamente ameaçada pelas mudanças climáticas."
83
  tokenizer = XLMRobertaTokenizer.from_pretrained(model_path, use_auth_token=True)
@@ -112,7 +112,7 @@ Use the code below to get started with the model.
112
 
113
  - **Train Dataset**: [ASSIN](https://huggingface.co/datasets/assin) <br>
114
 
115
- - **Evaluation Dataset used for Hyperparameter Tuning:** [ASSIN2](https://huggingface.co/datasets/assin2)'s validation split
116
 
117
  - **Test Datasets:**
118
  - [ASSIN](https://huggingface.co/datasets/assin)'s test split
@@ -121,16 +121,15 @@ Use the code below to get started with the model.
121
 
122
 
123
  ---
124
- This is a fine tuned version of [XLM-RoBERTa-base](https://huggingface.co/xlm-roberta-base) using the [ASSIN2 (Avaliação de Similaridade Semântica e Inferência textual)](https://huggingface.co/datasets/assin2) dataset. [ASSIN2](https://huggingface.co/datasets/assin2) is a corpus annotated with hypothesis/premise Portuguese sentence pairs suitable for detecting textual entailment or neutral
125
- relationship between the members of such pairs. Such corpus is balanced with 7k *ptbr* (Brazilian Portuguese) sentence pairs.
126
 
127
  ### Fine-Tuning Procedure
128
 
129
  <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
130
  The model's fine-tuning procedure can be summarized in three major subsequent tasks:
131
  <ol type="i">
132
- <li>**Data Processing:**</li> [ASSIN2](https://huggingface.co/datasets/assin2)'s *validation* and *train* splits were loaded from the **Hugging Face Hub** and processed afterwards;
133
- <li>**Hyperparameter Tuning:**</li> [XLM-RoBERTa-base](https://huggingface.co/xlm-roberta-base)'s hyperparameters were chosen with the help of the [Weights & Biases] API to track the results and upload the fine-tuned models;
134
  <li>**Final Model Loading and Testing:**</li>
135
  using the *cross-tests* approach described in the [this section](#evaluation), the models' performance were measured using different datasets and metrics.
136
  </ol>
@@ -154,37 +153,39 @@ $$
154
 
155
  The following hyperparameters were tested in order to maximize the evaluation accuracy.
156
 
157
- - **Number of Training Epochs:** $(1,2,3)$
158
  - **Per Device Train Batch Size:** $(8,16,32)$
159
- - **Learning Rate:** $(1e−5, 2e−5, 5e−5)$
160
 
161
 
162
- The hyperaparemeter tuning experiments were run and tracked using the [Weights & Biases' API](https://docs.wandb.ai/ref/python/public-api/api) and can be found at this [link](https://wandb.ai/gio_projs/assin_xlm_roberta_v5?workspace=user-giogvn).
163
 
164
 
165
  #### Training Hyperparameters
166
 
167
  The [hyperparameter tuning](#hyperparameter-tuning) performed yelded the following values:
168
 
169
- - **Number of Training Epochs:** $3$
170
- - **Per Device Train Batch Size:** $8$
171
  - **Learning Rate:** $5e-5$
172
 
173
  ## Evaluation
174
 
175
  ### ASSIN
176
 
177
- Testing this model in ASSIN's test split was straightforward because this model was fine tuned using ASSIN2's training set which contains the same labels as ASSIN. Hence, it can predict the same labels as the ones found in ASSIN's test set.
 
 
178
 
179
  ### ASSIN2
180
 
181
- Testing this model in ASSIN2's test split is straightforward because this model was fine tuned using ASSIN2's training set and therefore can predict the same labels as the ones found in its test set.
182
 
183
  ### PLUE/MNLI
184
 
185
- Testing this model in PLUE/MNLI was only possible by considering PLUE/MNLI's *contradiction* and *neutral* labels as *NONE* and PLUE/MNLI's *entailment* label as equivalent to the *ENTAILMENT* predicted by the model.
186
 
187
- More information on how such mapping is performed can be found in [Modelos para Inferência em Linguagem Natural que entendem a Língua Portuguesa](https://linux.ime.usp.br/~giovani/).
 
188
 
189
  ### Metrics
190
 
@@ -195,9 +196,9 @@ The model's performance metrics for each test dataset are presented separately.
195
 
196
  | test set | accuracy | f1 score | precision | recall |
197
  |----------|----------|----------|-----------|--------|
198
- | assin |0.78 |0.78 |0.80 |0.80 |
199
- | assin2 |0.86 |0.86 |0.87 |0.86 |
200
- | plue/mnli|0.71 |0.67 |0.71 |0.71 |
201
 
202
  ## Model Examination
203
 
@@ -238,3 +239,4 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
238
  <!--[2][Andrade, G. T. (2023) Modelos para Inferência em Linguagem Natural que entendem a Língua Portuguesa (train_assin_xlmr_base_results PAGES GO HERE)](https://linux.ime.usp.br/~giovani/)
239
 
240
  [3][Andrade, G. T. (2023) Modelos para Inferência em Linguagem Natural que entendem a Língua Portuguesa (train_assin_xlmr_base_conclusions PAGES GO HERE)](https://linux.ime.usp.br/~giovani/) -->
 
 
14
 
15
  <!-- Provide a quick summary of what the model is/does. -->
16
 
17
+ This is a **[BERTimbau-base](https://huggingface.co/neuralmind/bert-large-portuguese-cased) fine-tuned model** on 5K (premise, hypothesis) sentence pairs from
18
+ the **ASSIN (Avaliação de Similaridade Semântica e Inferência textual)** corpus. The original reference papers are:
19
+ [BERTimbau: Pretrained BERT Models for Brazilian Portuguese](https://www.researchgate.net/publication/345395208_BERTimbau_Pretrained_BERT_Models_for_Brazilian_Portuguese), [ASSIN: Avaliação de Similaridade Semântica e Inferência Textual](https://huggingface.co/datasets/assin), respectivelly. This model is suitable for Portuguese (from Brazil or Portugal).
20
 
21
  ## Model Details
22
 
 
44
 
45
  ### Direct Use
46
 
47
+ This fine-tuned version of [BERTimbau-base](https://huggingface.co/neuralmind/bert-large-portuguese-cased) performs Natural
48
  Language Inference (NLI), which is a text classification task.
49
 
50
  <!-- <div id="assin_function">
 
64
 
65
  The *(premise, hypothesis)* entailment definition used is the same as the one found in Salvatore's paper [1].
66
 
67
+ Therefore, this fine-tuned version of [BERTimbau-base](https://huggingface.co/neuralmind/bert-large-portuguese-cased) classifies pairs of sentences in the form *(premise, hypothesis)* into the classes *ENTAILMENT*, *NONE* and *PARAPHRASE*.
68
 
69
  <!-- ## Bias, Risks, and Limitations
70
 
 
77
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
78
  import torch
79
 
80
+ model_path = "giotvr/bertimbau_large_assin_fine_tuned"
81
  premise = "As mudanças climáticas são uma ameaça séria para a biodiversidade do planeta."
82
  hypothesis ="A biodiversidade do planeta é seriamente ameaçada pelas mudanças climáticas."
83
  tokenizer = XLMRobertaTokenizer.from_pretrained(model_path, use_auth_token=True)
 
112
 
113
  - **Train Dataset**: [ASSIN](https://huggingface.co/datasets/assin) <br>
114
 
115
+ - **Evaluation Dataset used for Hyperparameter Tuning:** [PLUE/MNLI](https://huggingface.co/datasets/dlb/plue)'s validation split
116
 
117
  - **Test Datasets:**
118
  - [ASSIN](https://huggingface.co/datasets/assin)'s test split
 
121
 
122
 
123
  ---
124
+ This is a fine tuned version of [BERTimbau-base](https://huggingface.co/neuralmind/bert-large-portuguese-cased) using the [ASSIN](https://huggingface.co/datasets/assin) dataset. [ASSIN](https://huggingface.co/datasets/assin) is a corpus annotated with hypothesis/premise Portuguese sentence pairs suitable for detecting textual entailment, none or paraphrase relationships between the members of such pairs. Such corpus is balanced among the three classes.
 
125
 
126
  ### Fine-Tuning Procedure
127
 
128
  <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
129
  The model's fine-tuning procedure can be summarized in three major subsequent tasks:
130
  <ol type="i">
131
+ <li>**Data Processing:**</li> [ASSIN](https://huggingface.co/datasets/assin)'s *validation* and *train* splits were loaded from the **Hugging Face Hub** and processed afterwards;
132
+ <li>**Hyperparameter Tuning:**</li>[BERTimbau-base](https://huggingface.co/neuralmind/bert-large-portuguese-cased)'s hyperparameters were chosen with the help of the [Weights & Biases] API to track the results and upload the fine-tuned models;
133
  <li>**Final Model Loading and Testing:**</li>
134
  using the *cross-tests* approach described in the [this section](#evaluation), the models' performance were measured using different datasets and metrics.
135
  </ol>
 
153
 
154
  The following hyperparameters were tested in order to maximize the evaluation accuracy.
155
 
156
+ - **Number of Training Epochs:** $(2,3,4)$
157
  - **Per Device Train Batch Size:** $(8,16,32)$
158
+ - **Learning Rate:** $(3e−5, 2e−5, 3e−5)$
159
 
160
 
161
+ The hyperparemeter tuning experiments were run and tracked using the [Weights & Biases' API](https://docs.wandb.ai/ref/python/public-api/api) and can be found at this [link](https://wandb.ai/gio_projs/assin_xlm_roberta_v5?workspace=user-giogvn).
162
 
163
 
164
  #### Training Hyperparameters
165
 
166
  The [hyperparameter tuning](#hyperparameter-tuning) performed yelded the following values:
167
 
168
+ - **Number of Training Epochs:** $2$
169
+ - **Per Device Train Batch Size:** $16$
170
  - **Learning Rate:** $5e-5$
171
 
172
  ## Evaluation
173
 
174
  ### ASSIN
175
 
176
+
177
+ Testing this model in ASSIN's test set was straightforward as it was fine-tuned in its training set.
178
+
179
 
180
  ### ASSIN2
181
 
182
+ Testing this model in ASSIN2's test set was straightforward as ASSIN2 contains the same classes as ASSIN.
183
 
184
  ### PLUE/MNLI
185
 
 
186
 
187
+ Testing this model in PLUE/MNLI's test split required some translation of the *neutral* and *contradictions* classes found in it, because such classes are not present in ASSIN. Both were considered equivalent to ASSIN's *NONE* class. More details on such translation can be found in [Modelos para Inferência em Linguagem Natural que entendem a Língua Portuguesa](https://linux.ime.usp.br/~giovani/).
188
+
189
 
190
  ### Metrics
191
 
 
196
 
197
  | test set | accuracy | f1 score | precision | recall |
198
  |----------|----------|----------|-----------|--------|
199
+ | assin |0.92 |0.92 |0.92 |0.92 |
200
+ | assin2 |0.73 |0.72 |0.77 |0.73 |
201
+ | plue/mnli|0.49 |0.40 |0.35 |0.49 |
202
 
203
  ## Model Examination
204
 
 
239
  <!--[2][Andrade, G. T. (2023) Modelos para Inferência em Linguagem Natural que entendem a Língua Portuguesa (train_assin_xlmr_base_results PAGES GO HERE)](https://linux.ime.usp.br/~giovani/)
240
 
241
  [3][Andrade, G. T. (2023) Modelos para Inferência em Linguagem Natural que entendem a Língua Portuguesa (train_assin_xlmr_base_conclusions PAGES GO HERE)](https://linux.ime.usp.br/~giovani/) -->
242
+