File size: 4,637 Bytes
ec61a63
 
9256efa
 
 
 
 
 
 
ec61a63
9256efa
 
 
3c19b79
9256efa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8520579
9256efa
 
 
 
b761ab1
9256efa
b761ab1
9256efa
b761ab1
9256efa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5bd7db5
 
 
 
9256efa
 
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
license: mit
language:
- gl
metrics:
- bleu (Gold1): 82.6
- bleu (Gold2): 49.9
- bleu (Flores): 23.8 
- bleu (Test-suite): 77.2 
---
license: mit
---

**English text [here](https://huggingface.co/proxectonos/Nos_MT-OpenNMT-gl-es/blob/main/README_English.md)**

**Descrición do Modelo**

Modelo feito con OpenNMT para o par galego-inglés utilizando unha arquitectura transformer.

**Como traducir**

+ Abrir terminal bash
+ Instalar [Python 3.9](https://www.python.org/downloads/release/python-390/)
+ Instalar [Open NMT toolkit v.2.2](https://github.com/OpenNMT/OpenNMT-py)
+ Traducir un input_text utilizando o modelo NOS-MT-gl-es co seguinte comando:

```bash 
onmt_translate -src input_text -model NOS-MT-gl-es.pt --output ./output_file.txt --replace_unk -gpu 0
```
+ O resultado da tradución estará no PATH indicado no flag -output.

**Adestramento**

No adestramento, utilizamos córpora auténticos e sintéticos do [ProxectoNós](https://github.com/proxectonos/corpora). Os primeiros son córpora de traducións feitas directamente por tradutores humanos. Os segundos son córpora de traducións inglés-portugués, que convertemos en inglés-galego a través da tradución automática portugués-galego con Opentrad/Apertium e transliteración para palabras fóra de vocabulario.
 

**Procedemento de adestramento / Training process**

+ Tokenización dos datasets feita co tokenizador (tokenizer.pl) de [linguakit](https://github.com/citiususc/Linguakit) que foi modificado para evitar o salto de liña por token do ficheiro orixinal. 

+ O vocabulario BPE para os modelos foi xerado a través do script [learn_bpe.py](https://github.com/OpenNMT/OpenNMT-py/blob/master/tools/learn_bpe.py) da OpenNMT

+ Utilizando o .yaml deste repositorio pode replicar o proceso de adestramento. É preciso modificar os paths do ficheiro .yaml para a Open NMT saber onde ir buscar os textos. Após facer isto, pode do seguinte xeito comezar o proceso:

```bash 
onmt_build_vocab -config  bpe-gl-es_emb.yaml -n_sample 100000
onmt_train -config bpe-gl-es_emb.yaml
```

**Hiperparámetros** 

Os parámetros usados para o desenvolvemento do modelo poden ser consultados directamente no mesmo ficheiro .yaml  bpe-gl-es_emb.yaml 

**Avaliación**

A avalación BLEU dos modelos é feita cunha mistura de tests desenvolvidos internamente (gold1, gold2, test-suite) con outros datasets disponíbeis en galego (Flores).

| GOLD 1        | GOLD 2        | FLORES  | TEST-SUITE|
| ------------- |:-------------:| -------:|----------:| 
| 82.6          | 49.9          | 23.8    | 77.2      |



**Licenzas do Modelo** 

MIT License

Copyright (c) 2023 Proxecto Nós

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

**Financiamento** 

Esta investigación foi financiada polo proxecto "Nós: o galego na sociedade e economía da intelixencia artificial", resultado dun acordo entre a Xunta de Galicia e a Universidade de Santiago de Compostela, o que resultou no subsidio ED431G2019/04 da Consellaría de Educación, Universidade e Formación Profesional da Galiza, e polo Fondo Europeo de Desenvolvemento Rexional (programa ERDF/FEDER), e Grupos de Referencia: ED431C 2020/21.  

 
**Citar este traballo**

Se utilizar este modelo no seu traballo, cite por favor así:

Daniel Bardanca Outeirinho, Pablo Gamallo Otero, Iria de-Dios-Flores, and José Ramom Pichel Campos. 2024.
Exploring the effects of vocabulary size in neural machine translation: Galician as a target language.
In Proceedings of the 16th International Conference on Computational Processing of Portuguese, pages 600–604,
Santiago de Compostela, Galiza. Association for Computational Lingustics.