Andresmfs commited on
Commit
1582803
1 Parent(s): 07f30b3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +221 -37
README.md CHANGED
@@ -4,8 +4,15 @@ datasets:
4
  - somosnlp/es-inclusive-language
5
  language:
6
  - es
 
 
 
 
 
 
7
  ---
8
- # es-inclusivo-translator
 
9
 
10
  This model is a fine-tuned version of [projecte-aina/aguila-7b](https://huggingface.co/projecte-aina/aguila-7b) on the dataset [somosnlp/es-inclusive-language](https://huggingface.co/datasets/somosnlp/es-inclusive-language).
11
 
@@ -13,32 +20,82 @@ Languages are powerful tools to communicate ideas, but their use is not impartia
13
  Spanish is not the exception to that. For instance, when we say “los alumnos” or “los ingenieros”, we are excluding women from those groups. Similarly, expressions such as “los gitanos” o “los musulmanes” perpetuate discrimination against these communities.
14
 
15
  In response to these linguistic challenges, this model offers a way to construct inclusive alternatives in accordance with official guidelines on inclusive language from various Spanish speaking countries. Its purpose is to provide grammatically correct and inclusive solutions to situations where our language choices might otherwise be exclusive.
 
16
  This is a tool that contributes to the fifth of the Sustainable Development Goals: Achieve gender equality and empower all women and girls.
17
 
18
  The model works in such a way that, given an input text, it returns the original text rewritten using inclusive language.
19
 
20
- It achieves the following results on the evaluation set:
21
  - Loss: 0.6030
22
 
23
- ## Model description
24
- - **Developed by**: Andrés Martínez Fernández-Salguero ([andresmfs](https://huggingface.co/Andresmfs)), Imanuel Rozenberg (manu_20392), Gaia Quintana Fleitas (gaiaq), Josué Sauca (josue_sauca), Miguel López (wizmik12)
25
- - **Language(s)**: Spanish
26
- - **Fine-tuned from the model**: [projecte-aina/aguila-7b](https://huggingface.co/projecte-aina/aguila-7b)
27
- - **License**: cc-by-nc-sa-4.0
28
 
29
- ## Social Impact
30
- An inclusive translator holds significant social impact by promoting equity and representation within texts. By rectifying biases ingrained in language and fostering inclusivity, it combats discrimination, amplifies the visibility of marginalized groups, and contributes to the cultivation of a more inclusive and respectful society.
31
- This is a tool that contributes to the fifth of the Sustainable Development Goals: Achieve gender equality and empower all women and girls.
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
- ## Intended uses & limitations
34
 
35
- ### Intended uses
36
- The general uses of this model are texts adaptations to inclusive language.
 
 
 
 
 
 
 
37
 
38
  It can be used to adapt news, blogposts, emails and official documents among others.
39
 
40
- ### How to use
41
- Here is how to use this model:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  ```python
44
  from transformers import AutoTokenizer
@@ -160,31 +217,73 @@ input_text = 'Los alumnos atienden a sus profesores'
160
  print(translate_es_inclusivo(input_text))
161
  ```
162
 
163
- ### Limitations
164
- - The model has not been trained on long-complex texts.
165
- - It has been trained mostly with sentences where the terms to be modified are at the beginning of the sentence.
166
- - It returns only one option.
167
- - The model does not detect or modify hate speech
168
 
 
169
 
170
- ## Training and evaluation data
171
 
172
- Training and evaluation data can be found in [somosnlp/es-inclusive-language](https://huggingface.co/datasets/somosnlp/es-inclusive-language)
173
 
174
- ## Training procedure
175
 
176
- ### Training hyperparameters
177
 
 
 
 
 
 
 
 
 
 
178
  The following hyperparameters were used during training:
179
- - learning_rate: 0.0001
180
- - train_batch_size: 8
181
- - eval_batch_size: 8
182
- - seed: 42
183
- - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
184
- - lr_scheduler_type: linear
185
- - num_epochs: 10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
 
187
- ### Training results
 
 
 
 
 
 
 
 
 
 
 
188
 
189
  | Training Loss | Epoch | Step | Validation Loss |
190
  |:-------------:|:-----:|:----:|:---------------:|
@@ -199,16 +298,101 @@ The following hyperparameters were used during training:
199
  | 0.3898 | 9.0 | 3618 | 0.6209 |
200
  | 0.3771 | 10.0 | 4020 | 0.6292 |
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
 
203
- ### Framework versions
204
 
 
 
 
 
 
 
205
  - Transformers 4.30.0
206
  - Pytorch 2.2.2+cu121
207
  - Datasets 2.18.0
208
  - Tokenizers 0.13.3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
 
210
- ### Hardware
211
- - Nvidia T4 medium (8 vCPU, 30Gb RAM, 16Gb VRAM)
212
 
213
- ### Training time
214
- - 3 hours aprox
 
4
  - somosnlp/es-inclusive-language
5
  language:
6
  - es
7
+ metrics:
8
+ - bleurt
9
+ - sacrebleu
10
+ pipeline_tag: text2text-generation
11
+ tags:
12
+ - social
13
  ---
14
+
15
+ # Model Card for Traductor Inclusivo
16
 
17
  This model is a fine-tuned version of [projecte-aina/aguila-7b](https://huggingface.co/projecte-aina/aguila-7b) on the dataset [somosnlp/es-inclusive-language](https://huggingface.co/datasets/somosnlp/es-inclusive-language).
18
 
 
20
  Spanish is not the exception to that. For instance, when we say “los alumnos” or “los ingenieros”, we are excluding women from those groups. Similarly, expressions such as “los gitanos” o “los musulmanes” perpetuate discrimination against these communities.
21
 
22
  In response to these linguistic challenges, this model offers a way to construct inclusive alternatives in accordance with official guidelines on inclusive language from various Spanish speaking countries. Its purpose is to provide grammatically correct and inclusive solutions to situations where our language choices might otherwise be exclusive.
23
+ By rectifying biases ingrained in language and fostering inclusivity, it combats discrimination, amplifies the visibility of marginalized groups, and contributes to the cultivation of a more inclusive and respectful society.
24
  This is a tool that contributes to the fifth of the Sustainable Development Goals: Achieve gender equality and empower all women and girls.
25
 
26
  The model works in such a way that, given an input text, it returns the original text rewritten using inclusive language.
27
 
28
+ It achieves the following results on the validation set:
29
  - Loss: 0.6030
30
 
31
+ ## Model Details
 
 
 
 
32
 
33
+ ### Model Description
34
+
35
+ - **Developed by:** Andrés Martínez Fernández-Salguero, Imanuel Rozenberg, Gaia Quintana Fleitas, Miguel López Pérez y Josué Sauca
36
+ - **Funded by:** SomosNLP, HuggingFace
37
+ - **Model type:** Language model, instruction tuned
38
+ - **Language(s):** Spanish (`es-ES`, `es-AR`, `es-MX`, `es-CR`, `es-CL`)
39
+ - **License:** cc-by-nc-sa-4.0
40
+ - **Fine-tuned from model:** [projecte-aina/aguila-7b](https://huggingface.co/projecte-aina/aguila-7b)
41
+ - **Dataset used:** [somosnlp/es-inclusive-language](https://huggingface.co/datasets/somosnlp/es-inclusive-language)
42
+
43
+ ### Model Sources
44
+
45
+ - **Repository:** https://github.com/Andresmfs/Traductor_inclusivo
46
+ - **Demo:** https://huggingface.co/spaces/somosnlp/es-inclusive-language-demo
47
+ - **Video presentation:** https://www.youtube.com/watch?v=7rrNGJIXEHU
48
 
 
49
 
50
+ ## Uses
51
+
52
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
53
+
54
+ ### Direct Use
55
+
56
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
57
+
58
+ The general uses of this model are adaptations of texts in Spanish to inclusive language.
59
 
60
  It can be used to adapt news, blogposts, emails and official documents among others.
61
 
62
+ ### Downstream Use [optional]
63
+
64
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
65
+
66
+ [More Information Needed]
67
+
68
+ ### Out-of-Scope Use
69
+
70
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
71
+
72
+ [More Information Needed]
73
+
74
+ ## Bias, Risks, and Limitations
75
+
76
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
77
+
78
+ - Model has not been trained on long-complex texts.
79
+ - Model has been trained mostly with sentences where the terms to be modified are at the beginning of the sentence.
80
+ - Model returns only one translation option when several might also be adequate.
81
+ - Possible small information omission on translation.
82
+ - Possible forced use of the term "personas".
83
+ - Model does not detect or modify hate speech.
84
+ - Model has been trained on data mainly based on Spanish Inclusive Language Guidelines and may inherit any bias comming from the guidelines and institutions behind them. They are official and updated guidelines that should not contain strong biases.
85
+ - Model may not work propperly on translation difficulties aside the list of difficulties present on [es-inclusive-language dataset](https://huggingface.co/datasets/somosnlp/es-inclusive-language)
86
+ - Other biases coming from the train dataset [es-inclusive-language dataset](https://huggingface.co/datasets/somosnlp/es-inclusive-language) should be taken into account.
87
+
88
+
89
+ ### Recommendations
90
+
91
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
92
+
93
+ <!-- Example: Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations. -->
94
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
95
+
96
+ ## How to Get Started with the Model
97
+
98
+ Use the code below to get started with the model in 16-bits.
99
 
100
  ```python
101
  from transformers import AutoTokenizer
 
217
  print(translate_es_inclusivo(input_text))
218
  ```
219
 
220
+ ## Training Details
221
+ ### Training Data
222
+
223
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
 
224
 
225
+ Train, validation and test data splits can be found in [somosnlp/es-inclusive-language](https://huggingface.co/datasets/somosnlp/es-inclusive-language)
226
 
227
+ ### Training Procedure
228
 
229
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
230
 
231
+ <!-- Detallar la técnica de entrenamiento utilizada y enlazar los scripts/notebooks. -->
232
 
233
+ For training we used QLoRA technique in 4-bits and rank 8
234
 
235
+ Find the training script [here](https://github.com/Andresmfs/Traductor_inclusivo/tree/master)
236
+
237
+ #### Preprocessing [optional]
238
+
239
+ [More Information Needed]
240
+
241
+ #### Training Hyperparameters
242
+
243
+ <!-- Enumerar los valores de los hiperparámetros de entrenamiento. -->
244
  The following hyperparameters were used during training:
245
+ - **learning_rate:** 0.0001
246
+ - **train_batch_size:** 8
247
+ - **eval_batch_size:** 8
248
+ - **seed:** 42
249
+ - **optimizer:** Adam with betas=(0.9,0.999) and epsilon=1e-08
250
+ - **lr_scheduler_type:** linear
251
+ - **num_epochs:** 10
252
+ - **Training regime:** fp16 mixed precision
253
+
254
+ #### Speeds, Sizes, Times [optional]
255
+
256
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
257
+
258
+ [More Information Needed]
259
+
260
+
261
+ ## Evaluation
262
+
263
+ <!-- This section describes the evaluation protocols and provides the results. -->
264
+
265
+ ### Testing Data, Factors & Metrics
266
+
267
+ #### Testing Data
268
+ Here you can find the [validation set](https://huggingface.co/datasets/somosnlp/es-inclusive-language/viewer/default/validation) used during training.
269
+ Here you can find the [test set](https://huggingface.co/datasets/somosnlp/es-inclusive-language/viewer/default/test) used for evaluating model errors.
270
+
271
+ #### Factors
272
+
273
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
274
 
275
+ [More Information Needed]
276
+
277
+ #### Metrics
278
+
279
+ For test evaluation it has been used a weighted harmonic mean of metrics [bleurt](https://huggingface.co/spaces/evaluate-metric/bleurt) (60%) and [Sacrebleu](https://huggingface.co/spaces/evaluate-metric/sacrebleu) (40%).
280
+
281
+ In _Sacrebleu_ metric grammatical correctness carries high weight compared to the actual words used, whereas in _Bleurt_ metric the actual words used have higher weight over grammatical correctness.
282
+ Combining both metrics, we account for a grammatically correct prediction together with the use of the required specific words.
283
+
284
+ ### Results
285
+
286
+ <!-- Enlazar aquí los scripts/notebooks de evaluación y especificar los resultados. -->
287
 
288
  | Training Loss | Epoch | Step | Validation Loss |
289
  |:-------------:|:-----:|:----:|:---------------:|
 
298
  | 0.3898 | 9.0 | 3618 | 0.6209 |
299
  | 0.3771 | 10.0 | 4020 | 0.6292 |
300
 
301
+ On [this notebook](https://github.com/Andresmfs/Traductor_inclusivo/blob/master/Error%20analysis.ipynb) you can find the results of the test evaluation.
302
+
303
+ We get an average score of 68.4 (measured with the above described metric).
304
+ Due to the existence of equivalent language formulas (these are inclusive language formulas that can be used indistinctly and the choice of a formula over the other is rather a stylistic decision than a language correctness decision) it is possible to argue that the real score of the model is higher.
305
+
306
+ ## Model Examination [optional]
307
+
308
+ <!-- Relevant interpretability work for the model goes here. -->
309
+
310
+ [More Information Needed]
311
+
312
+ ## Environmental Impact
313
+
314
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly. -->
315
+
316
+ <!-- Rellenar la información de la lista y calcular las emisiones con la página mencionada. -->
317
+
318
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
319
+
320
+ - **Hardware Type:** Nvidia T4 medium (8 vCPU, 30 Gb RAM, 16 Gb VRAM)
321
+ - **Hours used:** 3 hours
322
+ - **Cloud Provider:** Google Cloud Platform
323
+ - **Compute Region:** [More Information Needed]
324
+ - **Carbon Emitted:** [More Information Needed]
325
+
326
+ ## Technical Specifications [optional]
327
+
328
+ <!-- Esta sección es opcional porque seguramente ya habéis mencionado estos detalles más arriba, igualmente está bien incluirlos aquí de nuevo como bullet points a modo de resumen. -->
329
+
330
+ ### Model Architecture and Objective
331
+
332
+ [More Information Needed]
333
+
334
+ ### Compute Infrastructure
335
 
336
+ [More Information Needed]
337
 
338
+ #### Hardware
339
+
340
+ <!-- Indicar el hardware utilizado, podéis agradecer aquí a quien lo patrocinó. -->
341
+ Hardware used was Nvidia T4 medium (8 vCPU, 30 Gb RAM, 16 Gb VRAM) patrocinated by Hugging Face
342
+
343
+ #### Software
344
  - Transformers 4.30.0
345
  - Pytorch 2.2.2+cu121
346
  - Datasets 2.18.0
347
  - Tokenizers 0.13.3
348
+ - Peft
349
+
350
+ ## License
351
+ <!-- Indicar bajo qué licencia se libera el modelo explicando, si no es apache 2.0, a qué se debe la licencia más restrictiva (i.e. herencia de las licencias del modelo pre-entrenado o de los datos utilizados). -->
352
+ Creative Commons (cc-by-nc-sa-4.0)
353
+
354
+ This kind of license is inherited from dataset used for training.
355
+
356
+ ## Citation
357
+
358
+ **BibTeX:**
359
+
360
+ ```
361
+ @software{AIGMJ2024TraductorInclusivo,
362
+ author = {Andrés Martínez Fernández-Salguero, Imanuel Rozenberg, Gaia Quintana Fleitas, Miguel López Pérez, Josué Sauca},
363
+ title = {TraductorInclusivo},
364
+ month = April,
365
+ year = 2024,
366
+ url = {https://huggingface.co/somosnlp/es-inclusivo-translator}
367
+ }
368
+ ```
369
+
370
+ - AIGMJ2024TraductorInclusivo
371
+ - author: Andrés Martínez Fernández-Salguero, Imanuel Rozenberg, Gaia Quintana Fleitas, Miguel López Pérez, Josué Sauca
372
+ - title: Traductor Inclusivo
373
+ - year: 2024
374
+ - url: https://huggingface.co/somosnlp/es-inclusivo-translator
375
+
376
+
377
+
378
+ ## Glossary [optional]
379
+
380
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
381
+
382
+ ## More Information
383
+
384
+ <!-- Indicar aquí que el marco en el que se desarrolló el proyecto, en esta sección podéis incluir agradecimientos y más información sobre los miembros del equipo. Podéis adaptar el ejemplo a vuestro gusto. -->
385
+
386
+ This project was developed during the [Hackathon #Somos600M](https://somosnlp.org/hackathon) organized by SomosNLP. The model was trained using GPUs sponsored by HuggingFace.
387
+
388
+ **Team:**
389
+ - [**Andrés Martínez Fernández-Salguero**](https://huggingface.co/Andresmfs)
390
+ - **Imanuel Rozenberg**
391
+ - **Gaia Quintana Fleitas**
392
+ - **Miguel López Pérez**
393
+ - **Josué Sauca**
394
 
395
+ ## Contact
 
396
 
397
+ - [**Andrés Martínez Fernández-Salguero**](www.linkedin.com/in/andrés-martínez-fernández-salguero-725674214) ([email protected])
398
+ - [**Gaia Quintana Fleitas**](https://www.linkedin.com/in/gaiaquintana/) ([email protected])