Translation
COMET
Vilém Zouhar commited on
Commit
cecb748
·
verified ·
1 Parent(s): 92eaa76

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +199 -0
  2. checkpoints/model.ckpt +3 -0
  3. hparams.yaml +36 -0
README.md ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: translation
3
+ library_name: comet
4
+ language:
5
+ - multilingual
6
+ - af
7
+ - am
8
+ - ar
9
+ - as
10
+ - az
11
+ - be
12
+ - bg
13
+ - bn
14
+ - br
15
+ - bs
16
+ - ca
17
+ - cs
18
+ - cy
19
+ - da
20
+ - de
21
+ - el
22
+ - en
23
+ - eo
24
+ - es
25
+ - et
26
+ - eu
27
+ - fa
28
+ - fi
29
+ - fr
30
+ - fy
31
+ - ga
32
+ - gd
33
+ - gl
34
+ - gu
35
+ - ha
36
+ - he
37
+ - hi
38
+ - hr
39
+ - hu
40
+ - hy
41
+ - id
42
+ - is
43
+ - it
44
+ - ja
45
+ - jv
46
+ - ka
47
+ - kk
48
+ - km
49
+ - kn
50
+ - ko
51
+ - ku
52
+ - ky
53
+ - la
54
+ - lo
55
+ - lt
56
+ - lv
57
+ - mg
58
+ - mk
59
+ - ml
60
+ - mn
61
+ - mr
62
+ - ms
63
+ - my
64
+ - ne
65
+ - nl
66
+ - 'no'
67
+ - om
68
+ - or
69
+ - pa
70
+ - pl
71
+ - ps
72
+ - pt
73
+ - ro
74
+ - ru
75
+ - sa
76
+ - sd
77
+ - si
78
+ - sk
79
+ - sl
80
+ - so
81
+ - sq
82
+ - sr
83
+ - su
84
+ - sv
85
+ - sw
86
+ - ta
87
+ - te
88
+ - th
89
+ - tl
90
+ - tr
91
+ - ug
92
+ - uk
93
+ - ur
94
+ - uz
95
+ - vi
96
+ - xh
97
+ - yi
98
+ - zh
99
+ license: apache-2.0
100
+ base_model:
101
+ - FacebookAI/xlm-roberta-large
102
+ ---
103
+
104
+ # COMET-poly-ic1-wmt25
105
+
106
+ This model is based on [COMET-poly](https://github.com/zouharvi/COMET-poly), which is a fork but not compatible with original Unbabel's COMET.
107
+ To run the model, you need to first install this version of COMET either with:
108
+ ```bash
109
+ pip install "git+https://github.com/zouharvi/COMET-poly#egg=comet-poly&subdirectory=comet_poly"
110
+ ```
111
+ or in editable mode:
112
+ ```bash
113
+ git clone https://github.com/zouharvi/COMET-poly.git
114
+ cd COMET-poly
115
+ pip3 install -e comet_poly
116
+ ```
117
+
118
+ This model scores the translation `mt` but takes additional in-context example: source `src2`, translation `mt2`, and score `score2`, which makes it a better quality estimator:
119
+ ```python
120
+ import comet_poly
121
+ model = comet_poly.load_from_checkpoint(comet_poly.download_model("zouharvi/COMET-poly-ic1-wmt25"))
122
+ data = [
123
+ {
124
+ "src": "Iceberg lettuce got its name in the 1920s when it was shipped packed in ice to stay fresh.",
125
+ "mt": "Eisbergsalat erhielt seinen Namen in den 1920er-Jahren, als er in Eis verpackt verschickt wurde, um frisch zu bleiben.",
126
+ "src2": "Lettuce is mostly water, which helps keep it crisp when chilled.",
127
+ "mt2": "Kopfsalat besteht größtenteils aus Wasser, was ihm hilft, beim Kühlen knackig zu bleiben.",
128
+ "score2": 94.5
129
+ },
130
+ {
131
+ "src": "Goats have rectangular pupils, which give them a wide field of vision—up to 320 degrees!",
132
+ "mt": "Kozy mají obdélníkové zornice, což jim umožňuje vidět skoro všude kolem sebe, aniž by musely otáčet hlavou.",
133
+ "src2": "Sheep, like goats, also have rectangular pupils for better peripheral vision.",
134
+ "mt2": "Вівці, як і кози, також мають прямокутні зіниці для кращого периферичного зору.",
135
+ "score2": 96.0
136
+ },
137
+ {
138
+ "src": "This helps them spot predators from almost all directions without moving their heads.",
139
+ "mt": "Điều này giúp chúng phát hiện kẻ săn mồi từ gần như mọi hướng mà không cần quay đầu.",
140
+ "src2": "Many prey animals have evolved to detect threats with minimal movement.",
141
+ "mt2": "Nhiều động vật thịt có tiến hóa để xem mối nguy bằng nhỏ đi lại.",
142
+ "score2": 42.3
143
+ }
144
+ ]
145
+ print("scores", model.predict(data, batch_size=8, gpus=1).scores)
146
+ ```
147
+ Outputs:
148
+ ```
149
+ scores [98.09857940673828, 85.52458953857422, 83.38972473144531]
150
+ ```
151
+
152
+ You can use a readily-available training data to do the on-the-fly retrieval.
153
+ Specifically, this model has been trained with retrieval based on `src`:
154
+ ```python
155
+ import datasets
156
+ import comet_poly.retrieval
157
+ data = [
158
+ {
159
+ "src": "Iceberg lettuce got its name in the 1920s when it was shipped packed in ice to stay fresh.",
160
+ "mt": "Eisbergsalat erhielt seinen Namen in den 1920er-Jahren, als er in Eis verpackt verschickt wurde, um frisch zu bleiben.",
161
+ },
162
+ {
163
+ "src": "Goats have rectangular pupils, which give them a wide field of vision—up to 320 degrees!",
164
+ "mt": "Kozy mají obdélníkové zornice, což jim umožňuje vidět skoro všude kolem sebe, aniž by musely otáčet hlavou.",
165
+ },
166
+ {
167
+ "src": "This helps them spot predators from almost all directions without moving their heads.",
168
+ "mt": "Điều này giúp chúng phát hiện kẻ săn mồi từ gần như mọi hướng mà không cần quay đầu.",
169
+ }
170
+ ]
171
+
172
+ data_kb = list(datasets.load_dataset("zouharvi/wmt-human-all", split="train"))
173
+ data_retrieved = comet_poly.retrieval.retrieve_from_kb(
174
+ data=data,
175
+ data_kb=data_kb,
176
+ k=1,
177
+ prevent_hardmatch=False,
178
+ key="src",
179
+ )
180
+ # add the retrieved data
181
+ for line, lines_retrieved in zip(data, data_retrieved):
182
+ for i in range(len(lines_retrieved)):
183
+ line[f"src{i+2}"] = lines_retrieved[i]["src"]
184
+ line[f"mt{i+2}"] = lines_retrieved[i]["mt"]
185
+ line[f"score{i+2}"] = lines_retrieved[i]["score"]
186
+
187
+ print("scores", model.predict(data, batch_size=8, gpus=1).scores)
188
+ ```
189
+
190
+ The training data is WMT up to 2024 (inclusive) with DA/ESA/MQM merged on a single scale.
191
+ This model is based on the work [TODO](TODO) which can be cited as:
192
+ ```
193
+ @misc{zuefle2025comet,
194
+ title={COMET-poly: Machine Translation Metric Grounded in Other Candidates},
195
+ author={Maike Züfle, Vilém Zouhar, Tu Anh Dinh, Felipe Polo, Jan Niehues, Mrinmaya Sachan},
196
+ year={2025},
197
+ }
198
+ ```
199
+
checkpoints/model.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d691b8ffe2258f31ed43a8eae61d9af0b2ad4a6900d0e355428d435edd70bec1
3
+ size 2478854385
hparams.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ activations: Tanh
2
+ additional_translation_in:
3
+ - true
4
+ - true
5
+ - true
6
+ - false
7
+ - false
8
+ backprop_additional_translation: true
9
+ batch_size: 8
10
+ class_identifier: polyic_metric
11
+ dropout: 0.1
12
+ encoder_learning_rate: 1.0e-06
13
+ encoder_model: XLM-RoBERTa
14
+ final_activation: null
15
+ hidden_sizes:
16
+ - 2048
17
+ - 1024
18
+ keep_embeddings_frozen: true
19
+ layer: mix
20
+ layer_norm: false
21
+ layer_transformation: sparsemax
22
+ layerwise_decay: 0.95
23
+ learning_rate: 1.5e-05
24
+ load_pretrained_weights: true
25
+ local_files_only: false
26
+ loss: mse
27
+ nr_frozen_epochs: 0.3
28
+ optimizer: AdamW
29
+ pool: avg
30
+ pretrained_model: xlm-roberta-large
31
+ train_data:
32
+ - data/csv/train_retrieval_minilm_11_src_wmt25.csv
33
+ use_ref: false
34
+ validation_data:
35
+ - data/csv/dev_retrieval_minilm_11_src.csv
36
+ warmup_steps: 0