zouharvi commited on
Commit
861cbe1
·
1 Parent(s): 3644ea2

init commit

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. README.md +146 -0
  3. checkpoints/model.ckpt +3 -0
  4. hparams.yaml +29 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ checkpoints/ filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: translation
3
+ language:
4
+ - multilingual
5
+ - af
6
+ - am
7
+ - ar
8
+ - as
9
+ - az
10
+ - be
11
+ - bg
12
+ - bn
13
+ - br
14
+ - bs
15
+ - ca
16
+ - cs
17
+ - cy
18
+ - da
19
+ - de
20
+ - el
21
+ - en
22
+ - eo
23
+ - es
24
+ - et
25
+ - eu
26
+ - fa
27
+ - fi
28
+ - fr
29
+ - fy
30
+ - ga
31
+ - gd
32
+ - gl
33
+ - gu
34
+ - ha
35
+ - he
36
+ - hi
37
+ - hr
38
+ - hu
39
+ - hy
40
+ - id
41
+ - is
42
+ - it
43
+ - ja
44
+ - jv
45
+ - ka
46
+ - kk
47
+ - km
48
+ - kn
49
+ - ko
50
+ - ku
51
+ - ky
52
+ - la
53
+ - lo
54
+ - lt
55
+ - lv
56
+ - mg
57
+ - mk
58
+ - ml
59
+ - mn
60
+ - mr
61
+ - ms
62
+ - my
63
+ - ne
64
+ - nl
65
+ - 'no'
66
+ - om
67
+ - or
68
+ - pa
69
+ - pl
70
+ - ps
71
+ - pt
72
+ - ro
73
+ - ru
74
+ - sa
75
+ - sd
76
+ - si
77
+ - sk
78
+ - sl
79
+ - so
80
+ - sq
81
+ - sr
82
+ - su
83
+ - sv
84
+ - sw
85
+ - ta
86
+ - te
87
+ - th
88
+ - tl
89
+ - tr
90
+ - ug
91
+ - uk
92
+ - ur
93
+ - uz
94
+ - vi
95
+ - xh
96
+ - yi
97
+ - zh
98
+ license: apache-2.0
99
+ base_model:
100
+ - FacebookAI/xlm-roberta-large
101
+ ---
102
+
103
+ # COMET-instant-self-confidence
104
+
105
+ This model is based on [COMET-early-exit](https://github.com/zouharvi/COMET-early-exit), which is a fork but not compatible with original Unbabel's COMET.
106
+ To run the model, you need to first install this version of COMET either with:
107
+ ```bash
108
+ pip install "git+https://github.com/zouharvi/COMET-early-exit#egg=comet-early-exit&subdirectory=comet_early_exit"
109
+ ```
110
+ or in editable mode:
111
+ ```bash
112
+ git clone https://github.com/zouharvi/COMET-early-exit.git
113
+ cd COMET-early-exit
114
+ pip3 install -e comet_early_exit
115
+ ```
116
+
117
+ This model specifically makes prediction at each of the 25 layers, both the score and the confidence.
118
+ This time, the confidence is the absolute error with respect to the final layer's prediction.
119
+ ```python
120
+ model = comet_early_exit.load_from_checkpoint(comet_early_exit.download_model("zouharvi/COMET-instant-self-confidence"))
121
+ data = [
122
+ {
123
+ "src": "Can I receive my food in 10 to 15 minutes?",
124
+ "mt": "Moh bych obdržet jídlo v 10 do 15 minut?",
125
+ },
126
+ {
127
+ "src": "Can I receive my food in 10 to 15 minutes?",
128
+ "mt": "Mohl bych dostat jídlo během 10 či 15 minut?",
129
+ }
130
+ ]
131
+ model_output = model.predict(data, batch_size=8, gpus=1)
132
+
133
+ # print predictions at 5th, 12th, and last layer
134
+ print("scores", model_output["scores"][0][5], model_output["scores"][0][12], model_output["scores"][0][-1])
135
+ print("estimated errors", model_output["confidences"][0][5], model_output["confidences"][0][12], model_output["confidences"][0][-1])
136
+
137
+ # two top-level outputs
138
+ assert len(model_output["scores"]) == 2 and len(model_output["confidences"]) == 2
139
+ # each output contains prediction per each layer
140
+ assert all(len(l) == 25 for l in model_output["scores"]) and all(len(l) == 25 for l in model_output["confidences"])
141
+ ```
142
+ Outputs (formatted):
143
+ ```
144
+ scores 75.60 86.60 85.74
145
+ estimated errors 10.48 3.52 0.83
146
+ ```
checkpoints/model.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:20d25859e408bba935d110b36229dd857e3eba7b6fa922aaada7b7b998e6a89c
3
+ size 2277649338
hparams.yaml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ activations: Tanh
2
+ batch_size: 32
3
+ class_identifier: earlyexitconfmulti_extra
4
+ confidence_target: last
5
+ dropout: 0.1
6
+ encoder_learning_rate: 1.0e-06
7
+ encoder_model: XLM-RoBERTa
8
+ final_activation: null
9
+ hidden_sizes:
10
+ - 2048
11
+ - 1024
12
+ keep_embeddings_frozen: true
13
+ layer: mix
14
+ layer_norm: false
15
+ layer_transformation: sparsemax
16
+ layerwise_decay: 0.95
17
+ learning_rate: 1.5e-05
18
+ load_pretrained_weights: true
19
+ local_files_only: false
20
+ loss: mse
21
+ nr_frozen_epochs: 0.3
22
+ optimizer: AdamW
23
+ pool: cls
24
+ pretrained_model: xlm-roberta-large
25
+ train_data:
26
+ - data/csv/train_da.csv
27
+ validation_data:
28
+ - data/csv/dev_da.csv
29
+ warmup_steps: 0