sambt22022517 commited on
Commit
8d7554f
1 Parent(s): d67059b
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitignore +1 -0
  2. app.py +330 -0
  3. model/vi_en/Translation_en_vi_baseline/final-result/metric.txt +2 -0
  4. model/vi_en/Translation_en_vi_baseline/final-result/translation.csv +0 -0
  5. model/vi_en/Translation_en_vi_baseline/log/model-en-vi-baseline.log +273 -0
  6. model/vi_en/Translation_en_vi_baseline/predict.py +93 -0
  7. model/vi_en/Translation_en_vi_baseline/result/eval-bleu.png +0 -0
  8. model/vi_en/Translation_en_vi_baseline/result/eval-loss.png +0 -0
  9. model/vi_en/Translation_en_vi_baseline/result/eval-rouge1.png +0 -0
  10. model/vi_en/Translation_en_vi_baseline/result/eval-rougeL.png +0 -0
  11. model/vi_en/Translation_en_vi_baseline/result/eval-ter.png +0 -0
  12. model/vi_en/Translation_en_vi_baseline/result/log-step.csv +167 -0
  13. model/vi_en/Translation_en_vi_baseline/result/train-loss.png +0 -0
  14. model/vi_en/Translation_en_vi_baseline/train.py +183 -0
  15. model/vi_en/Translation_en_vi_official/final-result/metric.txt +2 -0
  16. model/vi_en/Translation_en_vi_official/final-result/translation.csv +0 -0
  17. model/vi_en/Translation_en_vi_official/log/model-en-vi-official.log +484 -0
  18. model/vi_en/Translation_en_vi_official/predict.py +93 -0
  19. model/vi_en/Translation_en_vi_official/result/eval-bleu.png +0 -0
  20. model/vi_en/Translation_en_vi_official/result/eval-loss.png +0 -0
  21. model/vi_en/Translation_en_vi_official/result/eval-rougeL.png +0 -0
  22. model/vi_en/Translation_en_vi_official/result/eval-ter.png +0 -0
  23. model/vi_en/Translation_en_vi_official/result/log-step.csv +167 -0
  24. model/vi_en/Translation_en_vi_official/result/rouge1.png +0 -0
  25. model/vi_en/Translation_en_vi_official/result/train-loss.png +0 -0
  26. model/vi_en/Translation_en_vi_official/train.py +183 -0
  27. model/vi_en/Translation_en_vi_transformer/log/transformer-scratch.log +254 -0
  28. model/vi_en/Translation_en_vi_transformer/predict.py +287 -0
  29. model/vi_en/Translation_en_vi_transformer/result/metrics.txt +1 -0
  30. model/vi_en/Translation_en_vi_transformer/result/translation.csv +0 -0
  31. model/vi_en/Translation_en_vi_transformer/train.py +427 -0
  32. model/vi_en/Translation_vi_en_baseline/final-result/metric.txt +2 -0
  33. model/vi_en/Translation_vi_en_baseline/final-result/translation.csv +0 -0
  34. model/vi_en/Translation_vi_en_baseline/log/model-vi-en-baseline.log +273 -0
  35. model/vi_en/Translation_vi_en_baseline/predict.py +93 -0
  36. model/vi_en/Translation_vi_en_baseline/result/eval-bleu.png +0 -0
  37. model/vi_en/Translation_vi_en_baseline/result/eval-loss.png +0 -0
  38. model/vi_en/Translation_vi_en_baseline/result/eval-rouge1.png +0 -0
  39. model/vi_en/Translation_vi_en_baseline/result/eval-rougeL.png +0 -0
  40. model/vi_en/Translation_vi_en_baseline/result/eval-ter.png +0 -0
  41. model/vi_en/Translation_vi_en_baseline/result/log-step.csv +167 -0
  42. model/vi_en/Translation_vi_en_baseline/result/train-loss.png +0 -0
  43. model/vi_en/Translation_vi_en_baseline/train.py +183 -0
  44. model/vi_en/Translation_vi_en_official/final-result/metric.txt +2 -0
  45. model/vi_en/Translation_vi_en_official/final-result/translation.csv +0 -0
  46. model/vi_en/Translation_vi_en_official/log/model-vi-en-official.log +445 -0
  47. model/vi_en/Translation_vi_en_official/predict.py +93 -0
  48. model/vi_en/Translation_vi_en_official/result/eval-bleu.png +0 -0
  49. model/vi_en/Translation_vi_en_official/result/eval-loss.png +0 -0
  50. model/vi_en/Translation_vi_en_official/result/eval-rouge1.png +0 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ **/__pycache__/
app.py ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from translator import Translator
3
+
4
+ history_list = [['', '', '']]
5
+
6
+ translator = Translator()
7
+
8
+ def translate(data):
9
+ if data[in_selected] == 'Tiếng Việt':
10
+ sen = data[vie_in]
11
+ src_lang = 'vi'
12
+ elif data[in_selected] == 'Tiếng Anh':
13
+ sen = data[eng_in]
14
+ src_lang = 'en'
15
+ elif data[in_selected] == 'Tiếng Lào':
16
+ sen = data[lao_in]
17
+ src_lang = 'lo'
18
+ elif data[in_selected] == 'Tiếng Trung':
19
+ sen = data[chi_in]
20
+ src_lang = 'zh'
21
+ elif data[in_selected] == 'Tiếng Khơ-me':
22
+ sen = data[kho_in]
23
+ src_lang = 'km'
24
+
25
+ if data[out_selected] == 'Tiếng Việt':
26
+ tgt_lang = 'vi'
27
+ return {vie_out: translator.translate(sen, src_lang, tgt_lang, data[models])}
28
+ if data[out_selected] == 'Tiếng Anh':
29
+ tgt_lang = 'en'
30
+ return {eng_out: translator.translate(sen, src_lang, tgt_lang, data[models])}
31
+ if data[out_selected] == 'Tiếng Lào':
32
+ tgt_lang = 'lo'
33
+ return {lao_out: translator.translate(sen, src_lang, tgt_lang, data[models])}
34
+ if data[out_selected] == 'Tiếng Trung':
35
+ tgt_lang = 'zh'
36
+ return {chi_out: translator.translate(sen, src_lang, tgt_lang, data[models])}
37
+ tgt_lang = 'km'
38
+ return {kho_out: translator.translate(sen, src_lang, tgt_lang, data[models])}
39
+
40
+ def clear_all_func():
41
+ return {vie_in: '', eng_in: '', lao_in: '', chi_in: '', kho_in: '', vie_out: '', eng_out: '', lao_out: '', chi_out: '', kho_out: ''}
42
+
43
+ def default_func():
44
+ return {vie_in: '', eng_in: '', lao_in: '', chi_in: '', kho_in: '', models: 'Baseline'}
45
+
46
+ def set_input(data):
47
+ if data[lang] == 'Tiếng Việt':
48
+ return {vie_in: data[sentence]}
49
+ elif data[lang] == 'Tiếng Anh':
50
+ return {eng_in: data[sentence]}
51
+ elif data[lang] == 'Tiếng Lào':
52
+ return {lao_in: data[sentence]}
53
+ elif data[lang] == 'Tiếng Trung':
54
+ return {chi_in: data[sentence]}
55
+ elif data[lang] == 'Tiếng Khơ-me':
56
+ return {kho_in: data[sentence]}
57
+ return {}
58
+
59
+ def add_history(data):
60
+ if data[in_selected] == 'Tiếng Việt':
61
+ src = data[vie_in]
62
+ elif data[in_selected] == 'Tiếng Anh':
63
+ src = data[eng_in]
64
+ elif data[in_selected] == 'Tiếng Lào':
65
+ src = data[lao_in]
66
+ elif data[in_selected] == 'Tiếng Trung':
67
+ src = data[chi_in]
68
+ elif data[in_selected] == 'Tiếng Khơ-me':
69
+ src = data[kho_in]
70
+
71
+ if data[out_selected] == 'Tiếng Việt':
72
+ tgt = data[vie_out]
73
+ elif data[out_selected] == 'Tiếng Anh':
74
+ tgt = data[eng_out]
75
+ elif data[out_selected] == 'Tiếng Lào':
76
+ tgt = data[lao_out]
77
+ elif data[out_selected] == 'Tiếng Trung':
78
+ tgt = data[chi_out]
79
+ elif data[out_selected] == 'Tiếng Khơ-me':
80
+ tgt = data[kho_out]
81
+
82
+ if src == '':
83
+ if len(history_list) == 1:
84
+ return gr.Dataset(samples=history_list)
85
+ else:
86
+ return gr.Dataset(samples=history_list[1:])
87
+
88
+ choice = data[models]
89
+ history_list.append([src, tgt, choice])
90
+ return gr.Dataset(samples=history_list[1:])
91
+
92
+ def clear_all_history_func():
93
+ global history_list
94
+ history_list = [['', '', '']]
95
+ return gr.Dataset(samples=history_list)
96
+
97
+ def change_input_tab(data):
98
+ if vie_in in data.keys():
99
+ return 'Tiếng Việt'
100
+ if eng_in in data.keys():
101
+ return 'Tiếng Anh'
102
+ if lao_in in data.keys():
103
+ return 'Tiếng Lào'
104
+ if chi_in in data.keys():
105
+ return 'Tiếng Trung'
106
+ return 'Tiếng Khơ-me'
107
+
108
+ def change_output_tab(data):
109
+ if vie_out in data.keys():
110
+ return 'Tiếng Việt'
111
+ if eng_out in data.keys():
112
+ return 'Tiếng Anh'
113
+ if lao_out in data.keys():
114
+ return 'Tiếng Lào'
115
+ if chi_out in data.keys():
116
+ return 'Tiếng Trung'
117
+ return 'Tiếng Khơ-me'
118
+
119
+ js = """
120
+ function createGradioAnimation() {
121
+ var container = document.createElement('div');
122
+ container.id = 'gradio-animation';
123
+ container.style.fontSize = '2em';
124
+ container.style.fontWeight = 'bold';
125
+ container.style.textAlign = 'center';
126
+ container.style.marginBottom = '20px';
127
+
128
+ var text = 'Dịch Song Ngữ';
129
+ for (var i = 0; i < text.length; i++) {
130
+ (function(i){
131
+ setTimeout(function(){
132
+ var letter = document.createElement('span');
133
+ letter.style.opacity = '0';
134
+ letter.style.transition = 'opacity 0.5s';
135
+ letter.innerText = text[i];
136
+
137
+ container.appendChild(letter);
138
+
139
+ setTimeout(function() {
140
+ letter.style.opacity = '1';
141
+ }, 50);
142
+ }, i * 250);
143
+ })(i);
144
+ }
145
+
146
+ var gradioContainer = document.querySelector('.gradio-container');
147
+ gradioContainer.insertBefore(container, gradioContainer.firstChild);
148
+
149
+ return 'Animation created';
150
+ }
151
+ """
152
+
153
+ css = """
154
+ #scrollable-content {
155
+ max-height: 200px;
156
+ overflow-y: auto !important;
157
+ }
158
+ #translate-bttn {
159
+ font-size: 30px;
160
+ }
161
+
162
+ /* Hiệu ứng khi lướt chuột qua */
163
+ #translate-bttn:hover {
164
+ background-color: #00ff00; /* Nền xanh lá */
165
+ color: #000000; /* Chữ đen */
166
+ }
167
+
168
+ /* Hiệu ứng khi nhấn chuột */
169
+ #translate-bttn:active {
170
+ background-color: #008000; /* Nền xanh đậm */
171
+ color: #000000; /* Chữ đen */
172
+ }
173
+ """
174
+
175
+ with gr.Blocks(js=js, css=css) as demo:
176
+ # Tạo ra các Block
177
+ with gr.Row(equal_height=False):
178
+ with gr.Column(scale=20):
179
+ with gr.Tab("Tiếng Việt") as in_vie_tab:
180
+ vie_in = gr.Textbox(label='', lines=3)
181
+ with gr.Tab("Tiếng Anh") as in_eng_tab:
182
+ eng_in = gr.Textbox(label='', lines=3)
183
+ with gr.Tab("Tiếng Lào") as in_lao_tab:
184
+ lao_in = gr.Textbox(label='', lines=3)
185
+ with gr.Tab("Tiếng Trung") as in_chi_tab:
186
+ chi_in = gr.Textbox(label='', lines=3)
187
+ with gr.Tab("Tiếng Khơ-me") as in_kho_tab:
188
+ kho_in = gr.Textbox(label='', lines=3)
189
+ in_selected = gr.Textbox(label='Ngôn ngữ', value='Tiếng Việt', visible=True)
190
+
191
+ with gr.Row():
192
+ models = gr.Radio(["Baseline", "Pretrained Model"],
193
+ label="Mô hình thực hiện",
194
+ value="Baseline",
195
+ interactive=True,
196
+ scale=10)
197
+ trans_bttn = gr.Button('Dịch', elem_id='translate-bttn')
198
+
199
+ with gr.Column(scale=20):
200
+ with gr.Tab("Tiếng Việt") as out_vie_tab:
201
+ vie_out = gr.Textbox(label='', lines=3, interactive=False)
202
+ with gr.Tab("Tiếng Anh") as out_eng_tab:
203
+ eng_out = gr.Textbox(label='', lines=3, interactive=False)
204
+ with gr.Tab("Tiếng Lào") as out_lao_tab:
205
+ lao_out = gr.Textbox(label='', lines=3, interactive=False)
206
+ with gr.Tab("Tiếng Trung") as out_chi_tab:
207
+ chi_out = gr.Textbox(label='', lines=3, interactive=False)
208
+ with gr.Tab("Tiếng Khơ-me") as out_kho_tab:
209
+ kho_out = gr.Textbox(label='', lines=3, interactive=False)
210
+ out_selected = gr.Textbox(label='Ngôn ngữ', value='Tiếng Việt', visible=True)
211
+
212
+ with gr.Row():
213
+ save_history = gr.Button('Lưu lịch sử')
214
+ clear_all_history = gr.Button('Xoá toàn bộ lịch sử')
215
+
216
+ with gr.Row():
217
+ default = gr.Button('Trạng thái mặc định')
218
+ clear_all = gr.Button('Xoá tất cả')
219
+
220
+ with gr.Row():
221
+ lang = gr.Textbox(label='Ngôn ngữ', visible=False)
222
+ sentence = gr.Textbox(label='Câu ví dụ', visible=False)
223
+ examples = gr.Examples(
224
+ examples=[
225
+ ['Tiếng Việt', 'Tôi là ai', 'Baseline'],
226
+ ['Tiếng Anh', 'The one who is called Kira is me', 'Baseline'],
227
+ ['Tiếng Lào', 'ຂ້ອຍ', 'Baseline'],
228
+ ['Tiếng Trung', '那头牛', 'Baseline'],
229
+ ['Tiếng Khơ-me', 'អ្នកណាយំឈឺចាប់នេះ?', 'Baseline'],
230
+ ['Tiếng Việt', '12 giờ đêm, khi những con bò lạc lối', 'Pretrained Model'],
231
+ ['Tiếng Anh', 'I love... your mother', 'Pretrained Model'],
232
+ ['Tiếng Lào', 'ດັ່ງທີ່ຄາດໄວ້, C-cup ຍັງບໍ່ພໍທີ່ຈະຊັກຈູງອ້າຍຂອງຂ້ອຍ', 'Pretrained Model'],
233
+ ['Tiếng Trung', '我哥哥被 E 罩杯的东西所吸引。', 'Pretrained Model'],
234
+ ['Tiếng Khơ-me', 'កុំមើល! វង្វេង!!', 'Pretrained Model'],
235
+ ],
236
+ inputs=[lang, sentence, models],
237
+ elem_id='scrollable-content',
238
+ label='Ví dụ',
239
+ )
240
+
241
+ src_sen = gr.Textbox(label='Câu nguồn', visible=False)
242
+ tgt_sen = gr.Textbox(label='Câu mục tiêu', visible=False)
243
+ histories = gr.Examples(
244
+ examples=history_list,
245
+ inputs=[src_sen, tgt_sen, models],
246
+ elem_id='scrollable-content',
247
+ label='Lịch sử',
248
+ cache_examples=False
249
+ )
250
+
251
+ # Xử lí phần sự kiện
252
+
253
+ ## Sự kiện nhấn nút dịch
254
+ gr.on(
255
+ triggers=[vie_in.submit, eng_in.submit, lao_in.submit, chi_in.submit, kho_in.submit, trans_bttn.click],
256
+ fn=translate,
257
+ inputs={vie_in, eng_in, lao_in, chi_in, kho_in, models, in_selected, out_selected},
258
+ outputs=[vie_out, eng_out, lao_out, chi_out, kho_out]
259
+ )
260
+
261
+ ## Sự kiện chuyển tab của phần Input
262
+ in_vie_tab.select(fn=change_input_tab,
263
+ inputs={vie_in},
264
+ outputs=[in_selected]
265
+ )
266
+ in_eng_tab.select(fn=change_input_tab,
267
+ inputs={eng_in},
268
+ outputs=[in_selected]
269
+ )
270
+ in_lao_tab.select(fn=change_input_tab,
271
+ inputs={lao_in},
272
+ outputs=[in_selected]
273
+ )
274
+ in_chi_tab.select(fn=change_input_tab,
275
+ inputs={chi_in},
276
+ outputs=[in_selected]
277
+ )
278
+ in_kho_tab.select(fn=change_input_tab,
279
+ inputs={kho_in},
280
+ outputs=[in_selected]
281
+ )
282
+
283
+ ## Sự kiện ẩn chuyển tab của phần Output
284
+ out_vie_tab.select(fn=change_output_tab,
285
+ inputs={vie_out},
286
+ outputs=[out_selected]
287
+ )
288
+ out_eng_tab.select(fn=change_output_tab,
289
+ inputs={eng_out},
290
+ outputs=[out_selected]
291
+ )
292
+ out_lao_tab.select(fn=change_output_tab,
293
+ inputs={lao_out},
294
+ outputs=[out_selected]
295
+ )
296
+ out_chi_tab.select(fn=change_output_tab,
297
+ inputs={chi_out},
298
+ outputs=[out_selected]
299
+ )
300
+ out_kho_tab.select(fn=change_output_tab,
301
+ inputs={kho_out},
302
+ outputs=[out_selected]
303
+ )
304
+
305
+ ## Sự kiện nút Mặc định
306
+ default.click(fn=default_func,
307
+ inputs=None,
308
+ outputs=[vie_in, eng_in, lao_in, chi_in, kho_in, models]
309
+ )
310
+
311
+ ## Sự kiện xoá tất cả
312
+ clear_all.click(fn=clear_all_func,
313
+ inputs=None,
314
+ outputs=[vie_in, eng_in, lao_in, chi_in, kho_in, vie_out, eng_out, lao_out, chi_out, kho_out]
315
+ )
316
+
317
+ ## Sự kiện click vô Ví dụ
318
+ sentence.change(fn=set_input,
319
+ inputs={lang, sentence},
320
+ outputs=[vie_in, eng_in, lao_in, chi_in, kho_in])
321
+
322
+ ## Sự kiện với Lịch sử
323
+ save_history.click(fn=add_history,
324
+ inputs={vie_out, eng_out, lao_out, chi_out, kho_out, vie_in, eng_in, lao_in, chi_in, kho_in, models, in_selected, out_selected},
325
+ outputs=histories.dataset)
326
+ clear_all_history.click(fn=clear_all_history_func,
327
+ inputs=None,
328
+ outputs=histories.dataset)
329
+
330
+ demo.launch()
model/vi_en/Translation_en_vi_baseline/final-result/metric.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ bleu ter chrf rouge1 rougeL
2
+ 12.053431657255456 92.91312867406923 22.964739702878658 0.31416478257591357 0.27341178815887657
model/vi_en/Translation_en_vi_baseline/final-result/translation.csv ADDED
The diff for this file is too large to render. See raw diff
 
model/vi_en/Translation_en_vi_baseline/log/model-en-vi-baseline.log ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 8.2s 1 Collecting sacrebleu
2
+ 8.3s 2 Downloading sacrebleu-2.4.2-py3-none-any.whl.metadata (58 kB)
3
+ 8.3s 3 [?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/58.0 kB ? eta -:--:--
4
+ 8.4s 4 [?25hCollecting portalocker (from sacrebleu)
5
+ 8.4s 5 Downloading portalocker-2.10.1-py3-none-any.whl.metadata (8.5 kB)
6
+ 8.5s 6 Requirement already satisfied: regex in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (2023.12.25)
7
+ 8.5s 7 Requirement already satisfied: tabulate>=0.8.9 in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (0.9.0)
8
+ 8.5s 8 Requirement already satisfied: numpy>=1.17 in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (1.26.4)
9
+ 8.5s 9 Requirement already satisfied: colorama in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (0.4.6)
10
+ 8.5s 10 Requirement already satisfied: lxml in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (5.2.2)
11
+ 8.5s 11 Downloading sacrebleu-2.4.2-py3-none-any.whl (106 kB)
12
+ 8.6s 12 [?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/106.7 kB ? eta -:--:--
13
+ 8.6s 13 [?25hDownloading portalocker-2.10.1-py3-none-any.whl (18 kB)
14
+ 19.1s 14 Installing collected packages: portalocker, sacrebleu
15
+ 19.4s 15 Successfully installed portalocker-2.10.1 sacrebleu-2.4.2
16
+ 20.7s 16 Collecting rouge-score
17
+ 20.8s 17 Downloading rouge_score-0.1.2.tar.gz (17 kB)
18
+ 21.8s 18 Preparing metadata (setup.py) ... [?25l- done
19
+ 21.8s 19 [?25hRequirement already satisfied: absl-py in /opt/conda/lib/python3.10/site-packages (from rouge-score) (1.4.0)
20
+ 21.8s 20 Requirement already satisfied: nltk in /opt/conda/lib/python3.10/site-packages (from rouge-score) (3.2.4)
21
+ 21.8s 21 Requirement already satisfied: numpy in /opt/conda/lib/python3.10/site-packages (from rouge-score) (1.26.4)
22
+ 21.8s 22 Requirement already satisfied: six>=1.14.0 in /opt/conda/lib/python3.10/site-packages (from rouge-score) (1.16.0)
23
+ 21.8s 23 Building wheels for collected packages: rouge-score
24
+ 23.2s 24 Building wheel for rouge-score (setup.py) ... [?25l- \ done
25
+ 23.2s 25 [?25h Created wheel for rouge-score: filename=rouge_score-0.1.2-py3-none-any.whl size=24934 sha256=b6796ff028fdaad83a8b8a942afa0a0f19e0e8749b8bc281e26289acbe530bd1
26
+ 23.2s 26 Stored in directory: /root/.cache/pip/wheels/5f/dd/89/461065a73be61a532ff8599a28e9beef17985c9e9c31e541b4
27
+ 23.2s 27 Successfully built rouge-score
28
+ 33.0s 28 Installing collected packages: rouge-score
29
+ 33.1s 29 Successfully installed rouge-score-0.1.2
30
+ 33.4s 30 Note: you may need to restart the kernel to use updated packages.
31
+ 40.1s 31 2024-08-06 04:22:50.535640: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
32
+ 40.1s 32 2024-08-06 04:22:50.535769: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
33
+ 40.1s 33 2024-08-06 04:22:50.644904: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
34
+ 40.3s 34 2024-08-06 04:22:50.535640: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
35
+ 40.3s 35 2024-08-06 04:22:50.535769: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
36
+ 40.3s 36 2024-08-06 04:22:50.644904: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
37
+ 56.3s 37 /opt/conda/lib/python3.10/site-packages/transformers/tokenization_utils_base.py:4016: UserWarning: `as_target_tokenizer` is deprecated and will be removed in v5 of Transformers. You can tokenize your labels by using the argument `text_target` of the regular `__call__` method (either in the same call as your input texts if you use the same keyword arguments, or in a separate call.
38
+ 56.3s 38 warnings.warn(
39
+ 84.1s 39 wandb: W&B API key is configured. Use `wandb login --relogin` to force relogin
40
+ 84.1s 40 wandb: WARNING If you're specifying your api key in code, ensure this code is not shared publicly.
41
+ 84.1s 41 wandb: WARNING Consider setting the WANDB_API_KEY environment variable, or running `wandb login` from the command line.
42
+ 84.1s 42 wandb: Appending key for api.wandb.ai to your netrc file: /root/.netrc
43
+ 84.3s 43 /opt/conda/lib/python3.10/site-packages/transformers/training_args.py:1494: FutureWarning: `evaluation_strategy` is deprecated and will be removed in version 4.46 of 🤗 Transformers. Use `eval_strategy` instead
44
+ 84.3s 44 warnings.warn(
45
+ 85.5s 45 wandb: WARNING The `run_name` is currently set to the same value as `TrainingArguments.output_dir`. If this was not intended, please specify a different run name by setting the `TrainingArguments.run_name` parameter.
46
+ 85.5s 46 wandb: Currently logged in as: lananhmtms1 (lananhmtms1-mtms1). Use `wandb login --relogin` to force relogin
47
+ 100.8s 47 wandb: wandb version 0.17.5 is available! To upgrade, please run:
48
+ 100.8s 48 wandb: $ pip install wandb --upgrade
49
+ 100.8s 49 wandb: Tracking run with wandb version 0.17.4
50
+ 100.8s 50 wandb: Run data is saved locally in /kaggle/working/wandb/run-20240806_042336-o4fgwvql
51
+ 100.8s 51 wandb: Run `wandb offline` to turn off syncing.
52
+ 100.8s 52 wandb: Syncing run ./results-en-vi-base
53
+ 100.8s 53 wandb: ⭐️ View project at https://wandb.ai/lananhmtms1-mtms1/huggingface
54
+ 100.8s 54 wandb: 🚀 View run at https://wandb.ai/lananhmtms1-mtms1/huggingface/runs/o4fgwvql
55
+ 103.6s 55 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
56
+ 103.6s 56 warnings.warn('Was asked to gather along dimension 0, but all '
57
+ 287.4s 57 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
58
+ 287.4s 58 warnings.warn('Was asked to gather along dimension 0, but all '
59
+ 444.3s 59 Translated: C nhng ti iu ti c iu ó vi iu iu i
60
+ 473.3s 60 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
61
+ 473.3s 61 warnings.warn('Was asked to gather along dimension 0, but all '
62
+ 658.4s 62 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
63
+ 658.4s 63 warnings.warn('Was asked to gather along dimension 0, but all '
64
+ 814.6s 64 Translated: Chng ta ng ta i iu i vi ó và iu v ó
65
+ 844.0s 65 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
66
+ 844.0s 66 warnings.warn('Was asked to gather along dimension 0, but all '
67
+ 1029.3s 67 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
68
+ 1029.3s 68 warnings.warn('Was asked to gather along dimension 0, but all '
69
+ 1186.5s 69 Translated: ó có mt nhng tôi v v nhng tôi ó, ó
70
+ 1216.0s 70 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
71
+ 1216.0s 71 warnings.warn('Was asked to gather along dimension 0, but all '
72
+ 1401.6s 72 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
73
+ 1401.6s 73 warnings.warn('Was asked to gather along dimension 0, but all '
74
+ 1557.8s 74 Translated: Chng tôi là mt mt tng tng i c vi ó ó i
75
+ 1587.1s 75 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
76
+ 1587.1s 76 warnings.warn('Was asked to gather along dimension 0, but all '
77
+ 1773.4s 77 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
78
+ 1773.4s 78 warnings.warn('Was asked to gather along dimension 0, but all '
79
+ 1930.5s 79 Translated: Chng tôi là mt mt tr vi ó ti có
80
+ 1959.9s 80 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
81
+ 1959.9s 81 warnings.warn('Was asked to gather along dimension 0, but all '
82
+ 2145.7s 82 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
83
+ 2145.7s 83 warnings.warn('Was asked to gather along dimension 0, but all '
84
+ 2302.7s 84 Translated: Chng tôi làm tôi c nhng và ca ây, và ây là, v
85
+ 2332.7s 85 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
86
+ 2332.7s 86 warnings.warn('Was asked to gather along dimension 0, but all '
87
+ 2519.7s 87 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
88
+ 2519.7s 88 warnings.warn('Was asked to gather along dimension 0, but all '
89
+ 2676.9s 89 Translated: Chng ta là mt chng ta tôi v v ó ó, v nhng c
90
+ 2706.6s 90 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
91
+ 2706.6s 91 warnings.warn('Was asked to gather along dimension 0, but all '
92
+ 2893.3s 92 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
93
+ 2893.3s 93 warnings.warn('Was asked to gather along dimension 0, but all '
94
+ 3050.8s 94 Translated: Chng ta là nhng t cn th nhng v iu ó, iu
95
+ 3080.8s 95 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
96
+ 3080.8s 96 warnings.warn('Was asked to gather along dimension 0, but all '
97
+ 3266.8s 97 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
98
+ 3266.8s 98 warnings.warn('Was asked to gather along dimension 0, but all '
99
+ 3423.9s 99 Translated: Chng tôi là nhng ngi nht và ó là ông c vi có nhng
100
+ 3453.8s 100 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
101
+ 3453.8s 101 warnings.warn('Was asked to gather along dimension 0, but all '
102
+ 3640.8s 102 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
103
+ 3640.8s 103 warnings.warn('Was asked to gather along dimension 0, but all '
104
+ 3798.1s 104 Translated: Chng tôi là mt nhng ngi nhng th và nó, v nó cn
105
+ 3828.2s 105 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
106
+ 3828.2s 106 warnings.warn('Was asked to gather along dimension 0, but all '
107
+ 4014.8s 107 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
108
+ 4014.8s 108 warnings.warn('Was asked to gather along dimension 0, but all '
109
+ 4172.5s 109 Translated: Chng tôi to c c to v nhng ó, v th ca
110
+ 4202.4s 110 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
111
+ 4202.4s 111 warnings.warn('Was asked to gather along dimension 0, but all '
112
+ 4389.9s 112 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
113
+ 4389.9s 113 warnings.warn('Was asked to gather along dimension 0, but all '
114
+ 4547.7s 114 Translated: Chng ta là nhng ngi nh v v nó là cnh th th thy
115
+ 4577.6s 115 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
116
+ 4577.6s 116 warnings.warn('Was asked to gather along dimension 0, but all '
117
+ 4764.2s 117 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
118
+ 4764.2s 118 warnings.warn('Was asked to gather along dimension 0, but all '
119
+ 4922.1s 119 Translated: chng tôi là nhng nhng th nghim và nh ó, v ó là ông
120
+ 4952.1s 120 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
121
+ 4952.1s 121 warnings.warn('Was asked to gather along dimension 0, but all '
122
+ 5139.7s 122 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
123
+ 5139.7s 123 warnings.warn('Was asked to gather along dimension 0, but all '
124
+ 5297.5s 124 Translated: Chng ta là nhng ngi nghiên t nht và ó, v vy cn c
125
+ 5327.6s 125 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
126
+ 5327.6s 126 warnings.warn('Was asked to gather along dimension 0, but all '
127
+ 5514.8s 127 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
128
+ 5514.8s 128 warnings.warn('Was asked to gather along dimension 0, but all '
129
+ 5672.5s 129 Translated: Chng ta là nhng nhng và ti ó, nhng ng th s thc
130
+ 5702.5s 130 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
131
+ 5702.5s 131 warnings.warn('Was asked to gather along dimension 0, but all '
132
+ 5890.7s 132 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
133
+ 5890.7s 133 warnings.warn('Was asked to gather along dimension 0, but all '
134
+ 6049.1s 134 Translated: Chng ta là mt ngi trng v v nhng nhà th và iu t
135
+ 6079.2s 135 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
136
+ 6079.2s 136 warnings.warn('Was asked to gather along dimension 0, but all '
137
+ 6267.4s 137 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
138
+ 6267.4s 138 warnings.warn('Was asked to gather along dimension 0, but all '
139
+ 6425.9s 139 Translated: Chng ta là nhng ngi hi ng và iu nh vy, vy, th
140
+ 6456.1s 140 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
141
+ 6456.1s 141 warnings.warn('Was asked to gather along dimension 0, but all '
142
+ 6644.1s 142 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
143
+ 6644.1s 143 warnings.warn('Was asked to gather along dimension 0, but all '
144
+ 6802.2s 144 Translated: Chng ta ng nhng ngi nh nhng ngi ng và ó là ông, v
145
+ 6832.3s 145 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
146
+ 6832.3s 146 warnings.warn('Was asked to gather along dimension 0, but all '
147
+ 7020.0s 147 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
148
+ 7020.0s 148 warnings.warn('Was asked to gather along dimension 0, but all '
149
+ 7177.8s 149 Translated: Chng tôi là nhng nhà nhà th và ây là ông tôi, vy, cô
150
+ 7208.4s 150 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
151
+ 7208.4s 151 warnings.warn('Was asked to gather along dimension 0, but all '
152
+ 7395.7s 152 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
153
+ 7395.7s 153 warnings.warn('Was asked to gather along dimension 0, but all '
154
+ 7553.1s 154 Translated: Chng ta có nhng ngôn ht vi và iu nh ó là ông tr
155
+ 7583.3s 155 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
156
+ 7583.3s 156 warnings.warn('Was asked to gather along dimension 0, but all '
157
+ 7771.0s 157 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
158
+ 7771.0s 158 warnings.warn('Was asked to gather along dimension 0, but all '
159
+ 7928.6s 159 Translated: Chng là nhà th nghim và cn ó là ông tr thành công s thch
160
+ 7958.8s 160 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
161
+ 7958.8s 161 warnings.warn('Was asked to gather along dimension 0, but all '
162
+ 8146.4s 162 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
163
+ 8146.4s 163 warnings.warn('Was asked to gather along dimension 0, but all '
164
+ 8304.5s 164 Translated: Chng ta là nhng ngi c c tt vt và v v nên ó, v
165
+ 8334.7s 165 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
166
+ 8334.7s 166 warnings.warn('Was asked to gather along dimension 0, but all '
167
+ 8522.5s 167 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
168
+ 8522.5s 168 warnings.warn('Was asked to gather along dimension 0, but all '
169
+ 8680.4s 169 Translated: Chng tôi là nhng ngh tht v v và ó là ông y, có th c
170
+ 8710.7s 170 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
171
+ 8710.7s 171 warnings.warn('Was asked to gather along dimension 0, but all '
172
+ 8898.0s 172 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
173
+ 8898.0s 173 warnings.warn('Was asked to gather along dimension 0, but all '
174
+ 9056.7s 174 Translated: Chng ta là nhng ng ngi t nht vy ó, và y làm cn
175
+ 9086.9s 175 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
176
+ 9086.9s 176 warnings.warn('Was asked to gather along dimension 0, but all '
177
+ 9274.5s 177 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
178
+ 9274.5s 178 warnings.warn('Was asked to gather along dimension 0, but all '
179
+ 9432.1s 179 Translated: Chng ta là nhà khoa hc và ó là ông, vy nên cn hc s
180
+ 9462.7s 180 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
181
+ 9462.7s 181 warnings.warn('Was asked to gather along dimension 0, but all '
182
+ 9650.1s 182 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
183
+ 9650.1s 183 warnings.warn('Was asked to gather along dimension 0, but all '
184
+ 9808.1s 184 Translated: Chng ta là nhà nhà nhng ngi thut và nên cu c n c
185
+ 9838.8s 185 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
186
+ 9838.8s 186 warnings.warn('Was asked to gather along dimension 0, but all '
187
+ 10026.4s 187 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
188
+ 10026.4s 188 warnings.warn('Was asked to gather along dimension 0, but all '
189
+ 10184.8s 189 Translated: Chng ta là nhng th nghim tt và iu ó y, v vy c
190
+ 10215.5s 190 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
191
+ 10215.5s 191 warnings.warn('Was asked to gather along dimension 0, but all '
192
+ 10403.9s 192 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
193
+ 10403.9s 193 warnings.warn('Was asked to gather along dimension 0, but all '
194
+ 10561.5s 194 Translated: Chng tôi là nhà nhào tht v và ó là ông n, v v ông n
195
+ 10591.8s 195 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
196
+ 10591.8s 196 warnings.warn('Was asked to gather along dimension 0, but all '
197
+ 10780.0s 197 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
198
+ 10780.0s 198 warnings.warn('Was asked to gather along dimension 0, but all '
199
+ 10938.4s 199 Translated: Chng tôi là nhng tr nht và vy ông ó, nên s s
200
+ 10970.0s 200 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
201
+ 10970.0s 201 warnings.warn('Was asked to gather along dimension 0, but all '
202
+ 11157.4s 202 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
203
+ 11157.4s 203 warnings.warn('Was asked to gather along dimension 0, but all '
204
+ 11315.3s 204 Translated: Chng ta là nhng ngi thc s tr ln và ó là, vy, ng
205
+ 11346.1s 205 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
206
+ 11346.1s 206 warnings.warn('Was asked to gather along dimension 0, but all '
207
+ 11533.6s 207 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
208
+ 11533.6s 208 warnings.warn('Was asked to gather along dimension 0, but all '
209
+ 11692.0s 209 Translated: Chng ta có nhng ngi nht và vy nó, v th nó s có
210
+ 11722.2s 210 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
211
+ 11722.2s 211 warnings.warn('Was asked to gather along dimension 0, but all '
212
+ 11909.8s 212 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
213
+ 11909.8s 213 warnings.warn('Was asked to gather along dimension 0, but all '
214
+ 12067.7s 214 Translated: Chng tôi là nhng nhà t nghin và v nên ông y, vy,
215
+ 12098.1s 215 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
216
+ 12098.1s 216 warnings.warn('Was asked to gather along dimension 0, but all '
217
+ 12286.0s 217 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
218
+ 12286.0s 218 warnings.warn('Was asked to gather along dimension 0, but all '
219
+ 12444.1s 219 Translated: Chng tôi là nhng nhà s tt v và nhng ngi ó là, vy
220
+ 12474.3s 220 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
221
+ 12474.3s 221 warnings.warn('Was asked to gather along dimension 0, but all '
222
+ 12661.9s 222 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
223
+ 12661.9s 223 warnings.warn('Was asked to gather along dimension 0, but all '
224
+ 12820.9s 224 Translated: Chng tôi là nhng nhà th và iu ó ó là c ngh thc hin
225
+ 12851.2s 225 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
226
+ 12851.2s 226 warnings.warn('Was asked to gather along dimension 0, but all '
227
+ 13039.5s 227 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
228
+ 13039.5s 228 warnings.warn('Was asked to gather along dimension 0, but all '
229
+ 13198.0s 229 Translated: Chng ta là nhng t tt v và cng th ni, th nên các
230
+ 13228.4s 230 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
231
+ 13228.4s 231 warnings.warn('Was asked to gather along dimension 0, but all '
232
+ 13416.2s 232 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
233
+ 13416.2s 233 warnings.warn('Was asked to gather along dimension 0, but all '
234
+ 13575.2s 234 Translated: Chng ta là nhng nhà bán tt và nó là ông y, thc s có th
235
+ 13605.3s 235 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
236
+ 13605.3s 236 warnings.warn('Was asked to gather along dimension 0, but all '
237
+ 13793.6s 237 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
238
+ 13793.6s 238 warnings.warn('Was asked to gather along dimension 0, but all '
239
+ 13951.0s 239 Translated: Chng ta là nhà tt nhng ngi th và n nhiên, vy nh
240
+ 13981.7s 240 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
241
+ 13981.7s 241 warnings.warn('Was asked to gather along dimension 0, but all '
242
+ 14170.3s 242 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
243
+ 14170.3s 243 warnings.warn('Was asked to gather along dimension 0, but all '
244
+ 14327.6s 244 Translated: Chng ta là nhng ngi th nghim và ó là ông ta, vy, có th
245
+ 14357.7s 245 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
246
+ 14357.7s 246 warnings.warn('Was asked to gather along dimension 0, but all '
247
+ 14545.8s 247 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
248
+ 14545.8s 248 warnings.warn('Was asked to gather along dimension 0, but all '
249
+ 14703.5s 249 Translated: Chng tôi là nhng ngh thut và vy nó, vy, các phc
250
+ 14734.2s 250 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
251
+ 14734.2s 251 warnings.warn('Was asked to gather along dimension 0, but all '
252
+ 14922.5s 252 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
253
+ 14922.5s 253 warnings.warn('Was asked to gather along dimension 0, but all '
254
+ 15079.9s 254 Translated: Chng ta là nhng nhà khoa hc tt và cng nh vy, nhng
255
+ 15110.1s 255 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
256
+ 15110.1s 256 warnings.warn('Was asked to gather along dimension 0, but all '
257
+ 15297.5s 257 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
258
+ 15297.5s 258 warnings.warn('Was asked to gather along dimension 0, but all '
259
+ 15455.8s 259 Translated: Chng ta là nhng nhng nghip nht và iu này, v nên ô
260
+ 15486.4s 260 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
261
+ 15486.4s 261 warnings.warn('Was asked to gather along dimension 0, but all '
262
+ 15674.0s 262 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
263
+ 15674.0s 263 warnings.warn('Was asked to gather along dimension 0, but all '
264
+ 15725.1s 264 wandb: - 0.007 MB of 0.007 MB uploaded
265
+ 15725.1s 265 warn(
266
+ 15725.1s 266 [NbConvertApp] WARNING | Config option `kernel_spec_manager_class` not recognized by `NbConvertApp`.
267
+ 15725.1s 267 [NbConvertApp] Converting notebook __notebook__.ipynb to notebook
268
+ 15725.6s 268 [NbConvertApp] Writing 199824 bytes to __notebook__.ipynb
269
+ 15727.2s 269 /opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py:2930: FutureWarning: --Exporter.preprocessors=["nbconvert.preprocessors.ExtractOutputPreprocessor"] for containers is deprecated in traitlets 5.0. You can pass `--Exporter.preprocessors item` ... multiple times to add items to a list.
270
+ 15727.2s 270 warn(
271
+ 15727.2s 271 [NbConvertApp] WARNING | Config option `kernel_spec_manager_class` not recognized by `NbConvertApp`.
272
+ 15727.3s 272 [NbConvertApp] Converting notebook __notebook__.ipynb to html
273
+ 15728.3s 273 [NbConvertApp] Writing 456038 bytes to __results__.html
model/vi_en/Translation_en_vi_baseline/predict.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, Seq2SeqTrainer, Seq2SeqTrainingArguments, DataCollatorForSeq2Seq
3
+ import sacrebleu
4
+ from rouge_score import rouge_scorer
5
+ import numpy as np
6
+ import html
7
+ from datasets import Dataset
8
+ import pandas as pd
9
+
10
+ SRC = 'en'
11
+ TRG = 'vi'
12
+ KIND = 'baseline'
13
+
14
+ def load_file(file_path):
15
+ lang = []
16
+
17
+ with open(file_path, "r", encoding="utf-8") as file:
18
+ content_en = file.read()
19
+ lang += content_en.split('\n')
20
+ lang = [html.unescape(sent) for sent in lang]
21
+ return lang
22
+
23
+ #tải model:
24
+ name_model = f"NguyenManhAI/translation-{SRC}-{TRG}-{KIND}"
25
+ model = AutoModelForSeq2SeqLM.from_pretrained(name_model)
26
+ tokenizer = AutoTokenizer.from_pretrained(name_model)
27
+
28
+ list_test = dict()
29
+ list_test[SRC] = load_file(f"../data/test/{SRC}-2013.{SRC}")
30
+ list_test[TRG] = load_file(f"../data/test/{TRG}-2013.{TRG}")
31
+
32
+ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
33
+ def predict(model, input_sentence, tokenizer):
34
+ # Dịch một câu hoàn chỉnh
35
+ # Token hóa câu đầu vào
36
+ inputs = tokenizer(input_sentence, return_tensors="pt", padding=True, truncation=True).to(device)
37
+
38
+ # Sử dụng mô hình để dự đoán
39
+ with torch.no_grad():
40
+ outputs = model.generate(**inputs, max_new_tokens = 50)
41
+
42
+ # Giải mã đầu ra của mô hình
43
+ translated_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True)
44
+ return translated_sentence
45
+
46
+ if __name__ == "__main__":
47
+ sentence = {
48
+ 'en': "I'm a doctor and so he is",
49
+ 'vi': "Tôi là một bác sĩ và anh ấy cũng vậy."
50
+ }
51
+
52
+ pred = predict(model, sentence[SRC], tokenizer)
53
+ print(pred)
54
+
55
+ translation = {
56
+ 'inputs':[],
57
+ 'preds':[],
58
+ 'labels':[]
59
+ }
60
+
61
+ for i in range(len(list_test[SRC])):
62
+ translation['inputs'].append(list_test[SRC][i])
63
+ translation['preds'].append(predict(model, list_test[SRC][i], tokenizer))
64
+ translation['labels'].append(list_test[TRG][i])
65
+
66
+ # Tính BLEU
67
+ bleu = sacrebleu.corpus_bleu(translation['preds'], [translation['labels']])
68
+ # Tính TER
69
+ ter = sacrebleu.corpus_ter(translation['preds'], [translation['labels']])
70
+ # Tính CHRF
71
+ chrf = sacrebleu.corpus_chrf(translation['preds'], [translation['labels']])
72
+
73
+ # Tính ROUGE
74
+ scorer = rouge_scorer.RougeScorer(['rouge1', 'rougeL'], use_stemmer=True)
75
+ rouge1_scores = []
76
+ rougeL_scores = []
77
+ for pred, label in zip(translation['preds'], translation['labels']):
78
+ scores = scorer.score(pred, label)
79
+ rouge1_scores.append(scores['rouge1'].fmeasure)
80
+ rougeL_scores.append(scores['rougeL'].fmeasure)
81
+
82
+ avg_rouge1 = sum(rouge1_scores) / len(rouge1_scores)
83
+ avg_rougeL = sum(rougeL_scores) / len(rougeL_scores)
84
+
85
+ metric_str = f"bleu\tter\tchrf\trouge1\trougeL\n{bleu.score}\t{ter.score}\t{chrf.score}\t{avg_rouge1}\t{avg_rougeL}"
86
+
87
+ f = open('final-result\metric.txt', 'w', encoding='utf-8')
88
+ f.write(metric_str)
89
+ f.close()
90
+
91
+ pd.DataFrame(translation).to_csv('final-result/translation.csv', index=False)
92
+
93
+ print("Lưu thành công")
model/vi_en/Translation_en_vi_baseline/result/eval-bleu.png ADDED
model/vi_en/Translation_en_vi_baseline/result/eval-loss.png ADDED
model/vi_en/Translation_en_vi_baseline/result/eval-rouge1.png ADDED
model/vi_en/Translation_en_vi_baseline/result/eval-rougeL.png ADDED
model/vi_en/Translation_en_vi_baseline/result/eval-ter.png ADDED
model/vi_en/Translation_en_vi_baseline/result/log-step.csv ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Step Training Loss Validation Loss Bleu Ter Rouge1 Rougel
2
+ 250 2.627700 1.644197 0.065444 102.810470 0.064245 0.062051
3
+ 500 1.628200 1.484654 0.288390 97.650880 0.133554 0.122853
4
+ 750 1.500700 1.417847 0.354922 95.965540 0.156740 0.143596
5
+ 1000 1.456000 1.378341 0.526384 94.247246 0.175121 0.161129
6
+ 1250 1.411100 1.349486 0.554477 93.729404 0.173738 0.161623
7
+ 1500 1.385600 1.325605 0.723026 93.122117 0.181949 0.168042
8
+ 1750 1.363100 1.303805 0.823366 92.420676 0.187867 0.174535
9
+ 2000 1.341900 1.287470 0.835699 91.884003 0.200039 0.184544
10
+ 2250 1.320500 1.271032 1.002635 91.031918 0.211180 0.193990
11
+ 2500 1.298800 1.258313 1.163212 90.937765 0.209801 0.192669
12
+ 2750 1.294300 1.243220 1.153392 90.203371 0.217644 0.199842
13
+ 3000 1.281100 1.228983 1.550688 89.370116 0.233425 0.211557
14
+ 3250 1.267900 1.220164 1.675214 89.068826 0.239106 0.216840
15
+ 3500 1.255400 1.205667 1.588106 88.645137 0.245444 0.223602
16
+ 3750 1.233600 1.196426 1.820132 88.325016 0.257691 0.232497
17
+ 4000 1.231600 1.183769 1.934878 87.920158 0.263296 0.238874
18
+ 4250 1.228300 1.172010 2.287752 87.265794 0.277792 0.250632
19
+ 4500 1.210700 1.161224 2.343722 86.922135 0.282720 0.255034
20
+ 4750 1.202400 1.153722 2.513547 86.456078 0.291601 0.261398
21
+ 5000 1.203500 1.140624 2.656975 85.942943 0.298051 0.268448
22
+ 5250 1.186000 1.131168 2.922282 85.716976 0.307243 0.275083
23
+ 5500 1.176700 1.121175 2.936947 85.213257 0.311061 0.278016
24
+ 5750 1.170600 1.112464 3.180533 85.076735 0.315466 0.282364
25
+ 6000 1.159600 1.105469 3.323173 84.888429 0.319794 0.286185
26
+ 6250 1.158800 1.097890 3.658102 83.979851 0.331756 0.296160
27
+ 6500 1.144200 1.090150 3.695026 83.880990 0.330546 0.296708
28
+ 6750 1.140400 1.085703 3.923268 83.509086 0.333630 0.298861
29
+ 7000 1.127600 1.077098 3.979903 83.579701 0.335560 0.300850
30
+ 7250 1.130600 1.067477 4.094874 83.137181 0.342696 0.306930
31
+ 7500 1.128700 1.063897 4.312253 82.755861 0.347492 0.310791
32
+ 7750 1.120800 1.057359 4.397489 82.581678 0.349256 0.312309
33
+ 8000 1.121200 1.052315 4.640964 82.657000 0.349732 0.313232
34
+ 8250 1.104300 1.046337 4.787352 82.332172 0.355654 0.317175
35
+ 8500 1.104100 1.041071 4.899065 82.181527 0.353432 0.317395
36
+ 8750 1.088300 1.034734 5.154683 81.668393 0.362565 0.323850
37
+ 9000 1.087000 1.028317 5.367251 81.343565 0.368787 0.329085
38
+ 9250 1.085700 1.026232 5.270144 81.640147 0.366218 0.327269
39
+ 9500 1.076600 1.020324 5.494634 81.254119 0.373639 0.332814
40
+ 9750 1.085400 1.014452 5.601409 81.207043 0.372757 0.333228
41
+ 10000 1.072300 1.008819 5.753288 81.004614 0.375827 0.336124
42
+ 10250 1.062700 1.003951 5.824650 80.910460 0.377952 0.337083
43
+ 10500 1.057900 0.997902 5.902168 80.821015 0.377506 0.337929
44
+ 10750 1.054100 0.994118 5.981207 80.453818 0.382981 0.342387
45
+ 11000 1.047600 0.990646 6.076846 80.279635 0.387679 0.346535
46
+ 11250 1.059900 0.984334 6.084267 80.223143 0.388361 0.347105
47
+ 11500 1.052700 0.981650 6.292561 80.016006 0.391179 0.350088
48
+ 11750 1.044200 0.976151 6.273452 80.133697 0.390527 0.349778
49
+ 12000 1.047100 0.973138 6.509788 79.870069 0.393277 0.352682
50
+ 12250 1.034100 0.970219 6.706573 79.592317 0.398129 0.355785
51
+ 12500 1.031600 0.966992 6.675276 79.375765 0.399087 0.356270
52
+ 12750 1.021400 0.961170 6.745674 79.187459 0.403253 0.360308
53
+ 13000 1.014900 0.959967 6.958013 79.210997 0.403968 0.360029
54
+ 13250 1.020200 0.956045 7.025415 79.107429 0.406925 0.361880
55
+ 13500 1.015900 0.953189 7.195114 79.145090 0.407031 0.362524
56
+ 13750 1.009300 0.950787 7.065260 78.923830 0.406814 0.362172
57
+ 14000 1.009800 0.943621 7.132338 78.905000 0.407837 0.364725
58
+ 14250 1.010100 0.942448 7.317758 78.890877 0.410191 0.367012
59
+ 14500 1.001300 0.938198 7.403996 78.490726 0.413053 0.369490
60
+ 14750 1.005600 0.935948 7.478498 78.443649 0.410890 0.367736
61
+ 15000 1.001800 0.931559 7.604042 78.401280 0.412341 0.368878
62
+ 15250 1.002300 0.927953 7.688558 78.325958 0.413995 0.371106
63
+ 15500 0.996300 0.926708 7.766576 78.147067 0.415794 0.372567
64
+ 15750 0.996100 0.923712 7.919211 78.245928 0.418260 0.373566
65
+ 16000 0.986600 0.920364 7.955050 78.109406 0.419570 0.375393
66
+ 16250 0.988200 0.917224 8.075858 77.582149 0.425575 0.380995
67
+ 16500 0.985500 0.914425 8.194338 77.859900 0.423397 0.379536
68
+ 16750 0.984800 0.913054 8.260551 77.596272 0.424273 0.381631
69
+ 17000 0.978500 0.910439 8.415732 77.219659 0.427690 0.383362
70
+ 17250 0.982300 0.908334 8.384414 77.384427 0.427202 0.382812
71
+ 17500 0.979200 0.904406 8.432118 77.271443 0.430293 0.385096
72
+ 17750 0.977500 0.902485 8.568459 77.144337 0.430542 0.386266
73
+ 18000 0.958900 0.901156 8.576069 77.436211 0.429110 0.384368
74
+ 18250 0.959500 0.898233 8.829191 77.083137 0.431090 0.386581
75
+ 18500 0.962600 0.896664 8.811914 76.927785 0.429840 0.387147
76
+ 18750 0.966600 0.894571 8.856628 77.252613 0.432888 0.388250
77
+ 19000 0.956200 0.891675 8.893505 77.285566 0.429843 0.385496
78
+ 19250 0.966900 0.889444 9.003679 77.214952 0.432689 0.388286
79
+ 19500 0.954900 0.887456 9.124519 76.993692 0.434827 0.389973
80
+ 19750 0.957900 0.886005 9.227721 76.734771 0.434806 0.389821
81
+ 20000 0.945100 0.884125 9.209296 76.786555 0.435456 0.390133
82
+ 20250 0.948200 0.881953 9.268570 76.744186 0.436718 0.391658
83
+ 20500 0.943500 0.881168 9.319876 76.715940 0.433865 0.391167
84
+ 20750 0.940500 0.878809 9.256061 76.570003 0.438009 0.393140
85
+ 21000 0.942500 0.877089 9.405705 76.871293 0.436517 0.392365
86
+ 21250 0.942500 0.875001 9.465343 76.522926 0.436819 0.393018
87
+ 21500 0.934500 0.873649 9.472936 76.494680 0.441052 0.396147
88
+ 21750 0.944900 0.872259 9.390609 76.395820 0.440584 0.395528
89
+ 22000 0.932200 0.869487 9.414966 76.645325 0.439741 0.394476
90
+ 22250 0.946700 0.868051 9.584151 76.329912 0.441111 0.395307
91
+ 22500 0.931000 0.866385 9.510247 76.381697 0.441110 0.395367
92
+ 22750 0.927700 0.864872 9.610698 76.320497 0.440212 0.396336
93
+ 23000 0.929700 0.863968 9.718435 76.311082 0.442863 0.397021
94
+ 23250 0.930100 0.862223 9.850952 76.052161 0.445375 0.400322
95
+ 23500 0.926200 0.860721 9.936575 75.915639 0.443956 0.399638
96
+ 23750 0.925400 0.858712 9.967990 76.042746 0.446046 0.401264
97
+ 24000 0.925900 0.857639 10.096671 75.877978 0.446397 0.402017
98
+ 24250 0.925300 0.856143 10.175190 76.014500 0.444481 0.401000
99
+ 24500 0.926700 0.854629 10.117966 75.736748 0.445366 0.401312
100
+ 24750 0.918200 0.854712 10.217045 75.896808 0.445830 0.401858
101
+ 25000 0.922200 0.851939 10.202913 75.830901 0.447015 0.401962
102
+ 25250 0.921500 0.851179 10.360602 75.732040 0.448666 0.403928
103
+ 25500 0.911100 0.849694 10.272043 75.868562 0.447008 0.402194
104
+ 25750 0.918800 0.848693 10.276174 75.647303 0.449982 0.404951
105
+ 26000 0.913600 0.847645 10.345470 75.807363 0.449043 0.404762
106
+ 26250 0.922100 0.846621 10.462485 75.487242 0.451472 0.407892
107
+ 26500 0.910000 0.845007 10.428833 75.562565 0.448986 0.405839
108
+ 26750 0.905300 0.844070 10.413072 75.534319 0.451794 0.407535
109
+ 27000 0.905000 0.843697 10.540369 75.487242 0.451758 0.407736
110
+ 27250 0.913500 0.843070 10.560556 75.327182 0.452559 0.408576
111
+ 27500 0.906700 0.840387 10.629209 75.444873 0.452537 0.408393
112
+ 27750 0.902600 0.839736 10.544614 75.284813 0.453074 0.409466
113
+ 28000 0.908100 0.838810 10.660547 75.284813 0.455547 0.411442
114
+ 28250 0.899500 0.837738 10.643213 75.383674 0.453473 0.410070
115
+ 28500 0.907000 0.837646 10.650279 75.388382 0.453337 0.409119
116
+ 28750 0.903600 0.836335 10.739483 75.313059 0.455209 0.411472
117
+ 29000 0.911700 0.835543 10.758739 75.247152 0.455721 0.411514
118
+ 29250 0.900100 0.834555 10.757329 75.185952 0.454988 0.410909
119
+ 29500 0.892500 0.833318 10.858246 75.091799 0.454998 0.411348
120
+ 29750 0.897000 0.832903 10.880794 75.077676 0.457176 0.412951
121
+ 30000 0.899000 0.831623 10.780874 75.265982 0.455298 0.410280
122
+ 30250 0.893700 0.831053 10.812154 75.063553 0.456747 0.413286
123
+ 30500 0.896100 0.830248 10.855250 75.143583 0.457235 0.412929
124
+ 30750 0.900600 0.829723 10.943592 75.025892 0.457687 0.413874
125
+ 31000 0.888200 0.828807 10.802195 75.148291 0.456015 0.411811
126
+ 31250 0.897900 0.827812 10.814122 74.875247 0.457076 0.413507
127
+ 31500 0.899100 0.827135 10.891732 74.856417 0.458300 0.414424
128
+ 31750 0.893000 0.826509 10.931727 74.969400 0.459407 0.415042
129
+ 32000 0.892800 0.825865 11.039062 74.856417 0.459129 0.415572
130
+ 32250 0.887300 0.825274 10.983367 75.035307 0.458136 0.414745
131
+ 32500 0.894700 0.824349 10.905021 75.035307 0.458091 0.414885
132
+ 32750 0.898100 0.823543 10.969078 74.922324 0.459772 0.415440
133
+ 33000 0.894500 0.822916 10.972579 74.959985 0.458621 0.415112
134
+ 33250 0.890500 0.822863 11.068211 74.865832 0.459588 0.415884
135
+ 33500 0.891200 0.821890 11.029868 74.828171 0.460945 0.417081
136
+ 33750 0.890800 0.821309 11.052303 74.809340 0.461285 0.416666
137
+ 34000 0.884700 0.821189 11.087364 74.682233 0.461172 0.417708
138
+ 34250 0.890400 0.820674 11.025102 74.781094 0.459885 0.416007
139
+ 34500 0.890200 0.820371 10.992115 74.861124 0.459446 0.415366
140
+ 34750 0.887500 0.819892 11.067214 74.696356 0.461642 0.417344
141
+ 35000 0.888500 0.819480 11.199964 74.583373 0.462673 0.418558
142
+ 35250 0.885500 0.818967 11.154836 74.701064 0.461443 0.418270
143
+ 35500 0.888200 0.818257 11.157596 74.705772 0.460943 0.417297
144
+ 35750 0.883100 0.817896 11.136658 74.635157 0.462180 0.418523
145
+ 36000 0.881900 0.817461 11.221197 74.649280 0.461815 0.417901
146
+ 36250 0.879200 0.817413 11.269516 74.385651 0.462369 0.419192
147
+ 36500 0.882700 0.817116 11.270089 74.583373 0.462395 0.418929
148
+ 36750 0.890500 0.816068 11.305302 74.418605 0.464837 0.420454
149
+ 37000 0.880300 0.816323 11.315746 74.357405 0.463152 0.419814
150
+ 37250 0.878200 0.816297 11.335717 74.324452 0.463925 0.420552
151
+ 37500 0.879500 0.816331 11.295830 74.508050 0.462985 0.419643
152
+ 37750 0.873700 0.815917 11.279245 74.442143 0.462336 0.419049
153
+ 38000 0.881500 0.815693 11.342169 74.475097 0.463437 0.419622
154
+ 38250 0.888600 0.815161 11.307758 74.451558 0.463186 0.420100
155
+ 38500 0.876200 0.815078 11.326251 74.385651 0.464323 0.420679
156
+ 38750 0.884300 0.814706 11.398963 74.343282 0.464915 0.421150
157
+ 39000 0.880300 0.814615 11.309243 74.329159 0.464053 0.420119
158
+ 39250 0.882700 0.814623 11.328777 74.451558 0.462804 0.419380
159
+ 39500 0.874900 0.814376 11.408448 74.291498 0.464396 0.421024
160
+ 39750 0.873700 0.814213 11.347434 74.366820 0.463777 0.420346
161
+ 40000 0.875700 0.814003 11.359607 74.357405 0.464388 0.420920
162
+ 40250 0.886000 0.813967 11.349502 74.282083 0.463924 0.420757
163
+ 40500 0.884300 0.813862 11.363786 74.418605 0.463203 0.419916
164
+ 40750 0.872600 0.813927 11.354252 74.371528 0.463216 0.419772
165
+ 41000 0.877700 0.813894 11.336277 74.395066 0.463134 0.419653
166
+ 41250 0.890900 0.813850 11.334885 74.418605 0.463340 0.419721
167
+ 41500 0.878800 0.813816 11.346388 74.399774 0.463420 0.419656
model/vi_en/Translation_en_vi_baseline/result/train-loss.png ADDED
model/vi_en/Translation_en_vi_baseline/train.py ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, Seq2SeqTrainer, Seq2SeqTrainingArguments, DataCollatorForSeq2Seq
3
+ import sacrebleu
4
+ from rouge_score import rouge_scorer
5
+ import numpy as np
6
+ import html
7
+ from datasets import Dataset
8
+
9
+ SRC = 'en'
10
+ TRG = 'vi'
11
+ KIND = 'baseline'
12
+ name_model = "google-t5/t5-small"
13
+
14
+ # load dữ liệu
15
+ def load_file(file_path):
16
+ lang = []
17
+
18
+ with open(file_path, "r", encoding="utf-8") as file:
19
+ content_en = file.read()
20
+ lang += content_en.split('\n')
21
+ lang = [html.unescape(sent) for sent in lang]
22
+ return lang
23
+
24
+ list_train = dict()
25
+ list_train[SRC] = load_file(f"../data/train/{SRC}.{SRC}")
26
+ list_train[TRG] = load_file(f"../data/train/{TRG}.{TRG}")
27
+
28
+ list_test = dict()
29
+ list_test[SRC] = load_file(f"../data/test/{SRC}-2013.{SRC}")
30
+ list_test[TRG] = load_file(f"../data/test/{TRG}-2013.{TRG}")
31
+
32
+ list_dev = dict()
33
+ list_dev[SRC] = load_file(f"../data/dev/{SRC}-2012.{SRC}")
34
+ list_dev[TRG] = load_file(f"../data/dev/{TRG}-2012.{TRG}")
35
+
36
+
37
+ dataset_train = Dataset.from_dict({"source": list_train[SRC], "target": list_train})
38
+ dataset_test = Dataset.from_dict({"source": list_test[SRC], "target": list_test[TRG]})
39
+ dataset_dev = Dataset.from_dict({"source": list_dev[SRC], "target": list_dev[TRG]})
40
+
41
+ #tải model:
42
+ model = AutoModelForSeq2SeqLM.from_pretrained(name_model)
43
+ tokenizer = AutoTokenizer.from_pretrained(name_model)
44
+
45
+ #tạo các phương thức cần thiết:
46
+ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
47
+ def predict(model, input_sentence, tokenizer):
48
+ # Dịch một câu hoàn chỉnh
49
+ # Token hóa câu đầu vào
50
+ inputs = tokenizer(input_sentence, return_tensors="pt", padding=True, truncation=True).to(device)
51
+
52
+ # Sử dụng mô hình để dự đoán
53
+ with torch.no_grad():
54
+ outputs = model.generate(**inputs, max_new_tokens = 50)
55
+
56
+ # Giải mã đầu ra của mô hình
57
+ translated_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True)
58
+ return translated_sentence
59
+
60
+ def tokenize_function(examples):
61
+ inputs = [ex for ex in examples['source']]
62
+ targets = [ex for ex in examples['target']]
63
+ model_inputs = tokenizer(inputs, max_length=80, truncation=True, padding="max_length") #80 -> 128
64
+
65
+ # Sử dụng tokenizer để mã hóa câu đích
66
+ with tokenizer.as_target_tokenizer():
67
+ labels = tokenizer(text_target = targets, max_length=80, truncation=True, padding="max_length") # 80 -> 128
68
+
69
+ # Thêm nhãn vào kết quả mã hóa
70
+ model_inputs["labels"] = labels["input_ids"]
71
+
72
+ return model_inputs
73
+
74
+ def compute_metrics(eval_pred):
75
+ predictions, labels = eval_pred
76
+
77
+ predictions = np.array(predictions)
78
+ predictions[predictions < 0] = 0
79
+ predictions = predictions.tolist()
80
+
81
+
82
+ labels = np.array(labels)
83
+ labels[labels < 0] = 0
84
+ labels = labels.tolist()
85
+
86
+ decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=True)
87
+ decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)
88
+
89
+ # Tính BLEU
90
+ bleu = sacrebleu.corpus_bleu(decoded_preds, [decoded_labels])
91
+
92
+ # Tính TER
93
+ ter = sacrebleu.corpus_ter(decoded_preds, [decoded_labels])
94
+
95
+ # Tính CHRF
96
+ chrf = sacrebleu.corpus_chrf(decoded_preds, [decoded_labels])
97
+
98
+ # Tính ROUGE
99
+ scorer = rouge_scorer.RougeScorer(['rouge1', 'rougeL'], use_stemmer=True)
100
+ rouge1_scores = []
101
+ rougeL_scores = []
102
+ for pred, label in zip(decoded_preds, decoded_labels):
103
+ scores = scorer.score(pred, label)
104
+ rouge1_scores.append(scores['rouge1'].fmeasure)
105
+ rougeL_scores.append(scores['rougeL'].fmeasure)
106
+
107
+ avg_rouge1 = sum(rouge1_scores) / len(rouge1_scores)
108
+ avg_rougeL = sum(rougeL_scores) / len(rougeL_scores)
109
+
110
+ return {
111
+ "bleu": bleu.score,
112
+ "ter": ter.score,
113
+ "chrf": chrf.score,
114
+ "rouge1": avg_rouge1,
115
+ "rougeL": avg_rougeL
116
+ }
117
+
118
+ # chuẩn bị dữ liệu:
119
+ tokenized_train = dataset_train.map(tokenize_function, batched=True)
120
+ tokenized_test = dataset_test.map(tokenize_function, batched=True)
121
+
122
+ data_collator = DataCollatorForSeq2Seq(tokenizer, model=model)
123
+
124
+ # thiết lập callback
125
+
126
+ from transformers import TrainerCallback
127
+
128
+ class CustomStepCallback(TrainerCallback):
129
+ def __init__(self, steps_interval, action_method):
130
+ self.steps_interval = steps_interval
131
+ self.action_method = action_method
132
+
133
+ def on_step_end(self, args, state, control, **kwargs):
134
+ # Thực hiện hành động sau mỗi steps_interval bước
135
+ if state.global_step % self.steps_interval == 0:
136
+ self.action_method(state.global_step)
137
+
138
+ # Định nghĩa phương thức hành động
139
+ def custom_action(step):
140
+ sentence = {
141
+ 'vi': "Chúng tôi là những bác sĩ xuất sắc và anh ấy cũng vậy, do đó ca phẫu thuật chắc chắn sẽ thành công.",
142
+ 'en': "We are excellent doctors and so is he, so the surgery will definitely be successful."
143
+ }
144
+ pred = predict(model, sentence[SRC], tokenizer)
145
+ print(f"Translated: {pred}")
146
+
147
+ # Khởi tạo callback với số bước và phương thức hành động
148
+ custom_callback = CustomStepCallback(steps_interval=1000, action_method=custom_action)
149
+
150
+ # thiết lập huấn luyện
151
+ training_args = Seq2SeqTrainingArguments(
152
+ output_dir=f"./results-{SRC}-{TRG}-base",
153
+ evaluation_strategy="steps",
154
+ eval_steps=250, #100 -> 250 x
155
+ learning_rate=3e-5, #3 -> 2
156
+ per_device_train_batch_size=16, #8 -> 16
157
+ per_device_eval_batch_size=16, #8 -> 16
158
+ weight_decay=0.01,
159
+ save_total_limit=3,
160
+ num_train_epochs=10, # 1 -> 10 x
161
+ predict_with_generate=True,
162
+ generation_max_length=50,
163
+ save_steps=500,
164
+ logging_dir="./logs", # Thư mục để lưu logs
165
+ logging_steps=250,
166
+ fp16 = True
167
+ )
168
+
169
+ trainer = Seq2SeqTrainer(
170
+ model=model,
171
+ args=training_args,
172
+ train_dataset=tokenized_train, #dev -> train x
173
+ eval_dataset=tokenized_test,
174
+ tokenizer=tokenizer,
175
+ data_collator=data_collator,
176
+ compute_metrics=compute_metrics,
177
+ callbacks=[custom_callback]
178
+ )
179
+
180
+ if __name__ == "__main__":
181
+ # huấn luyện và lưu lại mô hình
182
+ trainer.train()
183
+ torch.save(model.state_dict(), f"{SRC}-{TRG}-parameters-{KIND}.pth")
model/vi_en/Translation_en_vi_official/final-result/metric.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ bleu ter chrf rouge1 rougeL
2
+ 34.68588567842991 57.73113235556083 51.795557929371924 0.7530914794583412 0.6796403900330101
model/vi_en/Translation_en_vi_official/final-result/translation.csv ADDED
The diff for this file is too large to render. See raw diff
 
model/vi_en/Translation_en_vi_official/log/model-en-vi-official.log ADDED
@@ -0,0 +1,484 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 15.7s 1 Collecting sacrebleu
2
+ 15.8s 2 Downloading sacrebleu-2.4.2-py3-none-any.whl.metadata (58 kB)
3
+ 15.8s 3 [?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/58.0 kB ? eta -:--:--
4
+ 15.9s 4 [?25hCollecting portalocker (from sacrebleu)
5
+ 16.0s 5 Downloading portalocker-2.10.1-py3-none-any.whl.metadata (8.5 kB)
6
+ 16.0s 6 Requirement already satisfied: regex in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (2023.12.25)
7
+ 16.0s 7 Requirement already satisfied: tabulate>=0.8.9 in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (0.9.0)
8
+ 16.0s 8 Requirement already satisfied: numpy>=1.17 in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (1.26.4)
9
+ 16.0s 9 Requirement already satisfied: colorama in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (0.4.6)
10
+ 16.0s 10 Requirement already satisfied: lxml in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (5.2.2)
11
+ 16.1s 11 Downloading sacrebleu-2.4.2-py3-none-any.whl (106 kB)
12
+ 16.1s 12 [?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/106.7 kB ? eta -:--:--
13
+ 16.2s 13 [?25hDownloading portalocker-2.10.1-py3-none-any.whl (18 kB)
14
+ 28.1s 14 Installing collected packages: portalocker, sacrebleu
15
+ 28.3s 15 Successfully installed portalocker-2.10.1 sacrebleu-2.4.2
16
+ 29.6s 16 Collecting rouge-score
17
+ 29.7s 17 Downloading rouge_score-0.1.2.tar.gz (17 kB)
18
+ 31.0s 18 Preparing metadata (setup.py) ... [?25l- done
19
+ 31.0s 19 [?25hRequirement already satisfied: absl-py in /opt/conda/lib/python3.10/site-packages (from rouge-score) (1.4.0)
20
+ 31.0s 20 Requirement already satisfied: nltk in /opt/conda/lib/python3.10/site-packages (from rouge-score) (3.2.4)
21
+ 31.0s 21 Requirement already satisfied: numpy in /opt/conda/lib/python3.10/site-packages (from rouge-score) (1.26.4)
22
+ 31.0s 22 Requirement already satisfied: six>=1.14.0 in /opt/conda/lib/python3.10/site-packages (from rouge-score) (1.16.0)
23
+ 31.1s 23 Building wheels for collected packages: rouge-score
24
+ 32.6s 24 Building wheel for rouge-score (setup.py) ... [?25l- \ done
25
+ 32.6s 25 [?25h Created wheel for rouge-score: filename=rouge_score-0.1.2-py3-none-any.whl size=24934 sha256=625525a4adc177f5a70448e898d65cb1b0a93d0349fa83637d1b06e4bed5c489
26
+ 32.6s 26 Stored in directory: /root/.cache/pip/wheels/5f/dd/89/461065a73be61a532ff8599a28e9beef17985c9e9c31e541b4
27
+ 32.6s 27 Successfully built rouge-score
28
+ 42.6s 28 Installing collected packages: rouge-score
29
+ 42.8s 29 Successfully installed rouge-score-0.1.2
30
+ 43.2s 30 Note: you may need to restart the kernel to use updated packages.
31
+ 56.9s 31 2024-08-04 08:17:09.629217: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
32
+ 56.9s 32 2024-08-04 08:17:09.629369: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
33
+ 56.9s 33 2024-08-04 08:17:09.903206: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
34
+ 57.1s 34 2024-08-04 08:17:09.629217: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
35
+ 57.1s 35 2024-08-04 08:17:09.629369: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
36
+ 57.1s 36 2024-08-04 08:17:09.903206: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
37
+ 80.4s 37 /opt/conda/lib/python3.10/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
38
+ 80.4s 38 return self.fget.__get__(instance, owner)()
39
+ 83.6s 39 /opt/conda/lib/python3.10/site-packages/transformers/models/marian/tokenization_marian.py:175: UserWarning: Recommended: pip install sacremoses.
40
+ 83.6s 40 warnings.warn("Recommended: pip install sacremoses.")
41
+ 85.3s 41 /opt/conda/lib/python3.10/site-packages/transformers/tokenization_utils_base.py:4016: UserWarning: `as_target_tokenizer` is deprecated and will be removed in v5 of Transformers. You can tokenize your labels by using the argument `text_target` of the regular `__call__` method (either in the same call as your input texts if you use the same keyword arguments, or in a separate call.
42
+ 85.3s 42 warnings.warn(
43
+ 144.2s 43 wandb: W&B API key is configured. Use `wandb login --relogin` to force relogin
44
+ 144.2s 44 wandb: WARNING If you're specifying your api key in code, ensure this code is not shared publicly.
45
+ 144.2s 45 wandb: WARNING Consider setting the WANDB_API_KEY environment variable, or running `wandb login` from the command line.
46
+ 144.2s 46 wandb: Appending key for api.wandb.ai to your netrc file: /root/.netrc
47
+ 144.4s 47 /opt/conda/lib/python3.10/site-packages/transformers/training_args.py:1494: FutureWarning: `evaluation_strategy` is deprecated and will be removed in version 4.46 of 🤗 Transformers. Use `eval_strategy` instead
48
+ 144.4s 48 warnings.warn(
49
+ 145.9s 49 wandb: WARNING The `run_name` is currently set to the same value as `TrainingArguments.output_dir`. If this was not intended, please specify a different run name by setting the `TrainingArguments.run_name` parameter.
50
+ 145.9s 50 wandb: Currently logged in as: phuctranmtms1 (phuctranmtms1-mtms1). Use `wandb login --relogin` to force relogin
51
+ 161.2s 51 wandb: wandb version 0.17.5 is available! To upgrade, please run:
52
+ 161.2s 52 wandb: $ pip install wandb --upgrade
53
+ 161.3s 53 wandb: Tracking run with wandb version 0.17.4
54
+ 161.3s 54 wandb: Run data is saved locally in /kaggle/working/wandb/run-20240804_081839-fzh1co5a
55
+ 161.3s 55 wandb: Run `wandb offline` to turn off syncing.
56
+ 161.3s 56 wandb: Syncing run ./results-en-vi
57
+ 161.3s 57 wandb: ⭐️ View project at https://wandb.ai/phuctranmtms1-mtms1/huggingface
58
+ 161.3s 58 wandb: 🚀 View run at https://wandb.ai/phuctranmtms1-mtms1/huggingface/runs/fzh1co5a
59
+ 164.3s 59 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
60
+ 164.3s 60 warnings.warn('Was asked to gather along dimension 0, but all '
61
+ 549.5s 61 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
62
+ 549.5s 62 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
63
+ 551.6s 63 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
64
+ 551.6s 64 warnings.warn('Was asked to gather along dimension 0, but all '
65
+ 850.9s 65 Translated: Chúng tôi đều là những bác sĩ giỏi, và anh ấy cũng vậy. Vậy ca phẫu thuật chắc chắn sẽ thành công.
66
+ 942.2s 66 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
67
+ 942.2s 67 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
68
+ 944.0s 68 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
69
+ 944.0s 69 warnings.warn('Was asked to gather along dimension 0, but all '
70
+ 1334.2s 70 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
71
+ 1334.2s 71 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
72
+ 1336.1s 72 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
73
+ 1336.1s 73 warnings.warn('Was asked to gather along dimension 0, but all '
74
+ 1636.3s 74 Translated: Cả hai chúng tôi đều là những bác sĩ xuất sắc, và anh ấy cũng vậy. Ca phẫu thuật chắc chắn sẽ thành công.
75
+ 1729.1s 75 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
76
+ 1729.1s 76 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
77
+ 1731.0s 77 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
78
+ 1731.0s 78 warnings.warn('Was asked to gather along dimension 0, but all '
79
+ 2121.3s 79 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
80
+ 2121.3s 80 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
81
+ 2123.2s 81 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
82
+ 2123.2s 82 warnings.warn('Was asked to gather along dimension 0, but all '
83
+ 2423.8s 83 Translated: Chúng ta đều là những bác sĩ giỏi, và anh ta cũng vậy. Ca phẫu thuật chắc chắn sẽ thành công.
84
+ 2515.7s 84 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
85
+ 2515.7s 85 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
86
+ 2517.7s 86 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
87
+ 2517.7s 87 warnings.warn('Was asked to gather along dimension 0, but all '
88
+ 2909.6s 88 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
89
+ 2909.6s 89 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
90
+ 2911.6s 90 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
91
+ 2911.6s 91 warnings.warn('Was asked to gather along dimension 0, but all '
92
+ 3211.5s 92 Translated: Chúng ta đều là những bác sĩ giỏi, và anh ta cũng vậy. Ca phẫu thuật chắc chắn sẽ thành công.
93
+ 3303.4s 93 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
94
+ 3303.4s 94 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
95
+ 3305.4s 95 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
96
+ 3305.4s 96 warnings.warn('Was asked to gather along dimension 0, but all '
97
+ 3696.6s 97 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
98
+ 3696.6s 98 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
99
+ 3698.6s 99 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
100
+ 3698.6s 100 warnings.warn('Was asked to gather along dimension 0, but all '
101
+ 3998.2s 101 Translated: Chúng ta đều là những bác sĩ giỏi, và anh ta cũng vậy. Vậy nên ca phẫu thuật chắc chắn sẽ thành công.
102
+ 4089.6s 102 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
103
+ 4089.6s 103 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
104
+ 4091.5s 104 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
105
+ 4091.5s 105 warnings.warn('Was asked to gather along dimension 0, but all '
106
+ 4483.7s 106 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
107
+ 4483.7s 107 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
108
+ 4485.6s 108 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
109
+ 4485.6s 109 warnings.warn('Was asked to gather along dimension 0, but all '
110
+ 4786.3s 110 Translated: Chúng ta đều là những bác sĩ giỏi, và anh ta cũng vậy. Vậy nên ca phẫu thuật chắc chắn sẽ thành công.
111
+ 4879.5s 111 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
112
+ 4879.5s 112 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
113
+ 4881.4s 113 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
114
+ 4881.4s 114 warnings.warn('Was asked to gather along dimension 0, but all '
115
+ 5271.5s 115 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
116
+ 5271.5s 116 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
117
+ 5273.4s 117 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
118
+ 5273.4s 118 warnings.warn('Was asked to gather along dimension 0, but all '
119
+ 5573.1s 119 Translated: Chúng ta đều là những bác sỹ xuất sắc, và ông ấy cũng vậy. Vì vậy, cuộc phẫu thuật chắc chắn sẽ thành công.
120
+ 5665.4s 120 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
121
+ 5665.4s 121 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
122
+ 5667.3s 122 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
123
+ 5667.3s 123 warnings.warn('Was asked to gather along dimension 0, but all '
124
+ 6058.3s 124 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
125
+ 6058.3s 125 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
126
+ 6060.2s 126 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
127
+ 6060.2s 127 warnings.warn('Was asked to gather along dimension 0, but all '
128
+ 6360.9s 128 Translated: Chúng ta đều là những bác sĩ xuất sắc, và anh ta cũng vậy. Vậy là ca phẫu thuật chắc chắn sẽ thành công.
129
+ 6453.4s 129 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
130
+ 6453.4s 130 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
131
+ 6455.4s 131 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
132
+ 6455.4s 132 warnings.warn('Was asked to gather along dimension 0, but all '
133
+ 6845.9s 133 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
134
+ 6845.9s 134 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
135
+ 6847.8s 135 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
136
+ 6847.8s 136 warnings.warn('Was asked to gather along dimension 0, but all '
137
+ 7148.5s 137 Translated: Chúng ta đều là những bác sĩ giỏi, và anh ấy cũng vậy. Vậy nên cuộc phẫu thuật chắc chắn sẽ thành công.
138
+ 7239.8s 138 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
139
+ 7239.8s 139 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
140
+ 7241.8s 140 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
141
+ 7241.8s 141 warnings.warn('Was asked to gather along dimension 0, but all '
142
+ 7635.5s 142 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
143
+ 7635.5s 143 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
144
+ 7637.5s 144 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
145
+ 7637.5s 145 warnings.warn('Was asked to gather along dimension 0, but all '
146
+ 7938.3s 146 Translated: Cả hai chúng tôi đều là những bác sĩ xuất sắc, và anh ấy cũng vậy. Vì vậy, cuộc phẫu thuật chắc chắn sẽ thành công.
147
+ 8029.1s 147 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
148
+ 8029.1s 148 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
149
+ 8031.1s 149 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
150
+ 8031.1s 150 warnings.warn('Was asked to gather along dimension 0, but all '
151
+ 8424.2s 151 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
152
+ 8424.2s 152 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
153
+ 8426.1s 153 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
154
+ 8426.1s 154 warnings.warn('Was asked to gather along dimension 0, but all '
155
+ 8725.2s 155 Translated: Cả hai chúng tôi đều là những bác sĩ giỏi, và anh ấy cũng vậy. Vậy nên cuộc phẫu thuật chắc chắn sẽ thành công.
156
+ 8816.1s 156 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
157
+ 8816.1s 157 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
158
+ 8818.0s 158 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
159
+ 8818.0s 159 warnings.warn('Was asked to gather along dimension 0, but all '
160
+ 9209.4s 160 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
161
+ 9209.4s 161 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
162
+ 9211.3s 162 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
163
+ 9211.3s 163 warnings.warn('Was asked to gather along dimension 0, but all '
164
+ 9511.8s 164 Translated: Chúng tôi đều là những bác sĩ giỏi, và anh ta cũng thế. Ca phẫu thuật chắc chắn sẽ thành công.
165
+ 9604.4s 165 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
166
+ 9604.4s 166 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
167
+ 9606.3s 167 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
168
+ 9606.3s 168 warnings.warn('Was asked to gather along dimension 0, but all '
169
+ 9999.4s 169 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
170
+ 9999.4s 170 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
171
+ 10001.2s 171 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
172
+ 10001.2s 172 warnings.warn('Was asked to gather along dimension 0, but all '
173
+ 10301.8s 173 Translated: Chúng ta đều là những bác sĩ xuất sắc, và anh ta cũng vậy. Vậy nên cuộc phẫu thuật chắc chắn sẽ thành công.
174
+ 10394.9s 174 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
175
+ 10394.9s 175 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
176
+ 10396.9s 176 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
177
+ 10396.9s 177 warnings.warn('Was asked to gather along dimension 0, but all '
178
+ 10790.5s 178 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
179
+ 10790.5s 179 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
180
+ 10792.5s 180 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
181
+ 10792.5s 181 warnings.warn('Was asked to gather along dimension 0, but all '
182
+ 11092.2s 182 Translated: Chúng ta đều là những bác sĩ xuất sắc, và anh ta cũng vậy. Vậy nên ca phẫu thuật chắc chắn sẽ thành công.
183
+ 11184.5s 183 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
184
+ 11184.5s 184 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
185
+ 11186.5s 185 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
186
+ 11186.5s 186 warnings.warn('Was asked to gather along dimension 0, but all '
187
+ 11578.1s 187 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
188
+ 11578.1s 188 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
189
+ 11580.1s 189 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
190
+ 11580.1s 190 warnings.warn('Was asked to gather along dimension 0, but all '
191
+ 11880.1s 191 Translated: Cả hai chúng tôi đều là những bác sĩ giỏi, và anh ấy cũng vậy. Vậy nên cuộc phẫu thuật chắc chắn sẽ thành công.
192
+ 11973.3s 192 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
193
+ 11973.3s 193 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
194
+ 11975.3s 194 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
195
+ 11975.3s 195 warnings.warn('Was asked to gather along dimension 0, but all '
196
+ 12367.8s 196 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
197
+ 12367.8s 197 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
198
+ 12369.8s 198 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
199
+ 12369.8s 199 warnings.warn('Was asked to gather along dimension 0, but all '
200
+ 12670.1s 200 Translated: Chúng ta đều là những bác sĩ giỏi, và anh ta cũng vậy. Vì vậy ca phẫu thuật chắc chắn sẽ thành công.
201
+ 12762.6s 201 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
202
+ 12762.6s 202 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
203
+ 12764.6s 203 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
204
+ 12764.6s 204 warnings.warn('Was asked to gather along dimension 0, but all '
205
+ 13160.1s 205 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
206
+ 13160.1s 206 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
207
+ 13162.1s 207 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
208
+ 13162.1s 208 warnings.warn('Was asked to gather along dimension 0, but all '
209
+ 13463.5s 209 Translated: Cả hai chúng tôi đều là những bác sĩ xuất sắc, và anh ấy cũng vậy. Ca phẫu thuật chắc chắn sẽ thành công.
210
+ 13556.7s 210 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
211
+ 13556.7s 211 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
212
+ 13558.6s 212 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
213
+ 13558.6s 213 warnings.warn('Was asked to gather along dimension 0, but all '
214
+ 13951.2s 214 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
215
+ 13951.2s 215 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
216
+ 13953.1s 216 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
217
+ 13953.1s 217 warnings.warn('Was asked to gather along dimension 0, but all '
218
+ 14253.3s 218 Translated: Chúng ta đều là những bác sĩ xuất sắc, và anh ấy cũng vậy. Vì vậy, ca phẫu thuật chắc chắn sẽ thành công.
219
+ 14345.8s 219 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
220
+ 14345.8s 220 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
221
+ 14347.7s 221 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
222
+ 14347.7s 222 warnings.warn('Was asked to gather along dimension 0, but all '
223
+ 14740.1s 223 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
224
+ 14740.1s 224 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
225
+ 14742.1s 225 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
226
+ 14742.1s 226 warnings.warn('Was asked to gather along dimension 0, but all '
227
+ 15042.5s 227 Translated: Cả hai chúng tôi đều là những bác sĩ tuyệt vời, và anh ta cũng vậy. Ca phẫu thuật chắc chắn sẽ thành công.
228
+ 15134.5s 228 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
229
+ 15134.5s 229 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
230
+ 15136.4s 230 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
231
+ 15136.4s 231 warnings.warn('Was asked to gather along dimension 0, but all '
232
+ 15527.7s 232 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
233
+ 15527.7s 233 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
234
+ 15529.6s 234 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
235
+ 15529.6s 235 warnings.warn('Was asked to gather along dimension 0, but all '
236
+ 15831.6s 236 Translated: Chúng ta đều là những bác sĩ xuất sắc, và anh ta cũng vậy. Vì vậy, ca phẫu thuật chắc chắn sẽ thành công.
237
+ 15925.4s 237 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
238
+ 15925.4s 238 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
239
+ 15927.3s 239 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
240
+ 15927.3s 240 warnings.warn('Was asked to gather along dimension 0, but all '
241
+ 16317.7s 241 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
242
+ 16317.7s 242 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
243
+ 16319.6s 243 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
244
+ 16319.6s 244 warnings.warn('Was asked to gather along dimension 0, but all '
245
+ 16621.1s 245 Translated: Cả hai chúng tôi đều là những bác sĩ xuất sắc, và anh ta cũng vậy. Vậy nên ca phẫu thuật chắc chắn sẽ thành công.
246
+ 16713.9s 246 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
247
+ 16713.9s 247 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
248
+ 16715.9s 248 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
249
+ 16715.9s 249 warnings.warn('Was asked to gather along dimension 0, but all '
250
+ 17109.4s 250 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
251
+ 17109.4s 251 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
252
+ 17111.4s 252 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
253
+ 17111.4s 253 warnings.warn('Was asked to gather along dimension 0, but all '
254
+ 17412.3s 254 Translated: Chúng ta đều là những bác sĩ giỏi, và anh ta cũng vậy. Vậy nên cuộc phẫu thuật chắc chắn sẽ thành công.
255
+ 17504.6s 255 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
256
+ 17504.6s 256 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
257
+ 17506.5s 257 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
258
+ 17506.5s 258 warnings.warn('Was asked to gather along dimension 0, but all '
259
+ 17900.8s 259 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
260
+ 17900.8s 260 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
261
+ 17902.8s 261 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
262
+ 17902.8s 262 warnings.warn('Was asked to gather along dimension 0, but all '
263
+ 18203.2s 263 Translated: Chúng tôi đều là những bác sĩ xuất sắc, và anh ta cũng vậy. Vì vậy, cuộc phẫu thuật chắc chắn sẽ thành công.
264
+ 18296.4s 264 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
265
+ 18296.4s 265 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
266
+ 18298.3s 266 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
267
+ 18298.3s 267 warnings.warn('Was asked to gather along dimension 0, but all '
268
+ 18692.7s 268 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
269
+ 18692.7s 269 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
270
+ 18694.7s 270 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
271
+ 18694.7s 271 warnings.warn('Was asked to gather along dimension 0, but all '
272
+ 18996.1s 272 Translated: Cả hai chúng tôi đều là những bác sĩ tuyệt vời, và anh ấy cũng vậy. Vậy nên ca phẫu thuật chắc chắn sẽ thành công.
273
+ 19089.3s 273 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
274
+ 19089.3s 274 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
275
+ 19091.4s 275 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
276
+ 19091.4s 276 warnings.warn('Was asked to gather along dimension 0, but all '
277
+ 19485.5s 277 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
278
+ 19485.5s 278 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
279
+ 19487.4s 279 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
280
+ 19487.4s 280 warnings.warn('Was asked to gather along dimension 0, but all '
281
+ 19788.3s 281 Translated: Chúng tôi đều là những bác sĩ giỏi, và anh ấy cũng vậy. Vì vậy ca phẫu thuật chắc chắn sẽ thành công.
282
+ 19880.4s 282 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
283
+ 19880.4s 283 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
284
+ 19882.4s 284 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
285
+ 19882.4s 285 warnings.warn('Was asked to gather along dimension 0, but all '
286
+ 20276.3s 286 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
287
+ 20276.3s 287 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
288
+ 20278.3s 288 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
289
+ 20278.3s 289 warnings.warn('Was asked to gather along dimension 0, but all '
290
+ 20578.1s 290 Translated: Cả hai chúng tôi đều là những bác sĩ giỏi, và anh ta cũng vậy. Vậy nên ca phẫu thuật chắc chắn sẽ thành công.
291
+ 20670.4s 291 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
292
+ 20670.4s 292 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
293
+ 20672.3s 293 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
294
+ 20672.3s 294 warnings.warn('Was asked to gather along dimension 0, but all '
295
+ 21066.0s 295 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
296
+ 21066.0s 296 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
297
+ 21068.0s 297 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
298
+ 21068.0s 298 warnings.warn('Was asked to gather along dimension 0, but all '
299
+ 21369.2s 299 Translated: Chúng tôi đều là những bác sĩ giỏi, và anh ta cũng vậy. Vậy nên ca phẫu thuật chắc chắn sẽ thành công.
300
+ 21463.2s 300 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
301
+ 21463.2s 301 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
302
+ 21465.1s 302 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
303
+ 21465.1s 303 warnings.warn('Was asked to gather along dimension 0, but all '
304
+ 21859.4s 304 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
305
+ 21859.4s 305 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
306
+ 21861.4s 306 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
307
+ 21861.4s 307 warnings.warn('Was asked to gather along dimension 0, but all '
308
+ 22162.1s 308 Translated: Chúng tôi đều là những bác sĩ giỏi, và anh ấy cũng vậy. Vậy nên ca phẫu thuật chắc chắn sẽ thành công.
309
+ 22255.3s 309 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
310
+ 22255.3s 310 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
311
+ 22257.3s 311 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
312
+ 22257.3s 312 warnings.warn('Was asked to gather along dimension 0, but all '
313
+ 22649.9s 313 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
314
+ 22649.9s 314 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
315
+ 22651.8s 315 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
316
+ 22651.8s 316 warnings.warn('Was asked to gather along dimension 0, but all '
317
+ 22952.7s 317 Translated: Cả hai chúng tôi đều là những bác sĩ giỏi, và anh ấy cũng vậy. Ca phẫu thuật chắc chắn sẽ thành công.
318
+ 23046.6s 318 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
319
+ 23046.6s 319 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
320
+ 23048.5s 320 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
321
+ 23048.5s 321 warnings.warn('Was asked to gather along dimension 0, but all '
322
+ 23440.4s 322 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
323
+ 23440.4s 323 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
324
+ 23442.4s 324 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
325
+ 23442.4s 325 warnings.warn('Was asked to gather along dimension 0, but all '
326
+ 23742.7s 326 Translated: Cả hai chúng tôi đều là những bác sĩ xuất sắc, và anh ấy cũng vậy. Vậy nên ca phẫu thuật chắc chắn sẽ thành công.
327
+ 23835.5s 327 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
328
+ 23835.5s 328 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
329
+ 23837.4s 329 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
330
+ 23837.4s 330 warnings.warn('Was asked to gather along dimension 0, but all '
331
+ 24230.6s 331 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
332
+ 24230.6s 332 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
333
+ 24232.6s 333 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
334
+ 24232.6s 334 warnings.warn('Was asked to gather along dimension 0, but all '
335
+ 24533.9s 335 Translated: Chúng tôi đều là những bác sĩ giỏi, và anh ấy cũng vậy. Vậy nên ca phẫu thuật chắc chắn sẽ thành công.
336
+ 24627.1s 336 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
337
+ 24627.1s 337 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
338
+ 24629.0s 338 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
339
+ 24629.0s 339 warnings.warn('Was asked to gather along dimension 0, but all '
340
+ 25022.9s 340 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
341
+ 25022.9s 341 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
342
+ 25024.8s 342 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
343
+ 25024.8s 343 warnings.warn('Was asked to gather along dimension 0, but all '
344
+ 25325.6s 344 Translated: Cả hai chúng tôi đều là những bác sĩ giỏi, và anh ấy cũng vậy. Vì vậy, cuộc phẫu thuật chắc chắn sẽ thành công.
345
+ 25418.9s 345 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
346
+ 25418.9s 346 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
347
+ 25420.8s 347 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
348
+ 25420.8s 348 warnings.warn('Was asked to gather along dimension 0, but all '
349
+ 25815.2s 349 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
350
+ 25815.2s 350 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
351
+ 25817.5s 351 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
352
+ 25817.5s 352 warnings.warn('Was asked to gather along dimension 0, but all '
353
+ 26117.5s 353 Translated: Chúng tôi đều là những bác sĩ xuất sắc, anh ấy cũng vậy. Ca phẫu thuật chắc chắn sẽ thành công.
354
+ 26209.8s 354 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
355
+ 26209.8s 355 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
356
+ 26212.1s 356 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
357
+ 26212.1s 357 warnings.warn('Was asked to gather along dimension 0, but all '
358
+ 26607.2s 358 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
359
+ 26607.2s 359 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
360
+ 26609.2s 360 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
361
+ 26609.2s 361 warnings.warn('Was asked to gather along dimension 0, but all '
362
+ 26910.4s 362 Translated: Chúng tôi đều là những bác sĩ xuất sắc, và anh ấy cũng vậy. Vậy nên ca phẫu thuật chắc chắn sẽ thành công.
363
+ 27003.8s 363 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
364
+ 27003.8s 364 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
365
+ 27005.7s 365 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
366
+ 27005.7s 366 warnings.warn('Was asked to gather along dimension 0, but all '
367
+ 27397.7s 367 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
368
+ 27397.7s 368 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
369
+ 27399.6s 369 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
370
+ 27399.6s 370 warnings.warn('Was asked to gather along dimension 0, but all '
371
+ 27700.6s 371 Translated: Chúng tôi đều là những bác sĩ tuyệt vời, và anh ấy cũng vậy. Vì vậy, cuộc phẫu thuật chắc chắn sẽ thành công.
372
+ 27793.0s 372 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
373
+ 27793.0s 373 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
374
+ 27794.9s 374 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
375
+ 27794.9s 375 warnings.warn('Was asked to gather along dimension 0, but all '
376
+ 28188.7s 376 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
377
+ 28188.7s 377 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
378
+ 28190.7s 378 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
379
+ 28190.7s 379 warnings.warn('Was asked to gather along dimension 0, but all '
380
+ 28491.6s 380 Translated: Chúng tôi đều là những bác sĩ xuất sắc, và anh ấy cũng vậy. Ca phẫu thuật chắc chắn sẽ thành công.
381
+ 28584.5s 381 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
382
+ 28584.5s 382 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
383
+ 28586.4s 383 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
384
+ 28586.4s 384 warnings.warn('Was asked to gather along dimension 0, but all '
385
+ 28980.7s 385 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
386
+ 28980.7s 386 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
387
+ 28982.6s 387 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
388
+ 28982.6s 388 warnings.warn('Was asked to gather along dimension 0, but all '
389
+ 29283.8s 389 Translated: Cả hai chúng tôi đều là những bác sĩ giỏi, và anh ta cũng vậy. Vì vậy, cuộc phẫu thuật chắc chắn sẽ thành công.
390
+ 29377.9s 390 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
391
+ 29377.9s 391 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
392
+ 29379.9s 392 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
393
+ 29379.9s 393 warnings.warn('Was asked to gather along dimension 0, but all '
394
+ 29774.1s 394 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
395
+ 29774.1s 395 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
396
+ 29776.0s 396 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
397
+ 29776.0s 397 warnings.warn('Was asked to gather along dimension 0, but all '
398
+ 30076.9s 398 Translated: Chúng ta đều là những bác sĩ xuất sắc, và anh ta cũng vậy. Vì vậy, ca phẫu thuật chắc chắn sẽ thành công.
399
+ 30170.3s 399 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
400
+ 30170.3s 400 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
401
+ 30172.2s 401 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
402
+ 30172.2s 402 warnings.warn('Was asked to gather along dimension 0, but all '
403
+ 30565.8s 403 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
404
+ 30565.8s 404 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
405
+ 30567.8s 405 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
406
+ 30567.8s 406 warnings.warn('Was asked to gather along dimension 0, but all '
407
+ 30868.4s 407 Translated: Cả hai chúng tôi đều là những bác sĩ giỏi, và anh ấy cũng vậy. Vậy nên ca phẫu thuật chắc chắn sẽ thành công.
408
+ 30961.2s 408 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
409
+ 30961.2s 409 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
410
+ 30963.1s 410 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
411
+ 30963.1s 411 warnings.warn('Was asked to gather along dimension 0, but all '
412
+ 31356.3s 412 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
413
+ 31356.3s 413 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
414
+ 31358.2s 414 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
415
+ 31358.2s 415 warnings.warn('Was asked to gather along dimension 0, but all '
416
+ 31658.7s 416 Translated: Chúng tôi đều là những bác sĩ giỏi, và anh ấy cũng vậy. Vì vậy, ca phẫu thuật chắc chắn sẽ thành công.
417
+ 31751.3s 417 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
418
+ 31751.3s 418 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
419
+ 31753.3s 419 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
420
+ 31753.3s 420 warnings.warn('Was asked to gather along dimension 0, but all '
421
+ 32147.3s 421 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
422
+ 32147.3s 422 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
423
+ 32149.2s 423 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
424
+ 32149.2s 424 warnings.warn('Was asked to gather along dimension 0, but all '
425
+ 32449.6s 425 Translated: Chúng ta đều là những bác sĩ giỏi, và anh ta cũng vậy. Vậy nên ca phẫu thuật chắc chắn sẽ thành công.
426
+ 32542.0s 426 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
427
+ 32542.0s 427 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
428
+ 32544.0s 428 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
429
+ 32544.0s 429 warnings.warn('Was asked to gather along dimension 0, but all '
430
+ 32937.5s 430 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
431
+ 32937.5s 431 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
432
+ 32939.4s 432 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
433
+ 32939.4s 433 warnings.warn('Was asked to gather along dimension 0, but all '
434
+ 33009.9s 434 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
435
+ 33009.9s 435 Non-default generation parameters: {'max_length': 512, 'num_beams': 4, 'bad_words_ids': [[53684]], 'forced_eos_token_id': 0}
436
+ 33016.3s 436 Traceback (most recent call last):
437
+ 33016.3s 437 File "<string>", line 1, in <module>
438
+ 33016.3s 438 File "/opt/conda/lib/python3.10/site-packages/papermill/execute.py", line 134, in execute_notebook
439
+ 33016.3s 439 raise_for_execution_errors(nb, output_path)
440
+ 33016.3s 440 File "/opt/conda/lib/python3.10/site-packages/papermill/execute.py", line 241, in raise_for_execution_errors
441
+ 33016.3s 441 raise error
442
+ 33016.3s 442 papermill.exceptions.PapermillExecutionError:
443
+ 33016.3s 443 ---------------------------------------------------------------------------
444
+ 33016.3s 444 Exception encountered at "In [14]":
445
+ 33016.3s 445 ---------------------------------------------------------------------------
446
+ 33016.3s 446 FileNotFoundError Traceback (most recent call last)
447
+ 33016.3s 447 Cell In[14], line 1
448
+ 33016.3s 448 ----> 1 state_dict = torch.load('/kaggle/working/T5-en-vi-parameters.pth')
449
+ 33016.3s 449  3 # Cập nhật trọng số vào mô hình
450
+ 33016.3s 450  4 model_T5_en_vi.load_state_dict(state_dict)
451
+ 33016.3s 451
452
+ 33016.3s 452 File /opt/conda/lib/python3.10/site-packages/torch/serialization.py:986, in load(f, map_location, pickle_module, weights_only, mmap, **pickle_load_args)
453
+ 33016.3s 453  983 if 'encoding' not in pickle_load_args.keys():
454
+ 33016.3s 454  984 pickle_load_args['encoding'] = 'utf-8'
455
+ 33016.3s 455 --> 986 with _open_file_like(f, 'rb') as opened_file:
456
+ 33016.3s 456  987 if _is_zipfile(opened_file):
457
+ 33016.3s 457  988 # The zipfile reader is going to advance the current file position.
458
+ 33016.3s 458  989 # If we want to actually tail call to torch.jit.load, we need to
459
+ 33016.3s 459  990 # reset back to the original position.
460
+ 33016.3s 460  991 orig_position = opened_file.tell()
461
+ 33016.3s 461
462
+ 33016.3s 462 File /opt/conda/lib/python3.10/site-packages/torch/serialization.py:435, in _open_file_like(name_or_buffer, mode)
463
+ 33016.3s 463  433 def _open_file_like(name_or_buffer, mode):
464
+ 33016.3s 464  434 if _is_path(name_or_buffer):
465
+ 33016.3s 465 --> 435 return _open_file(name_or_buffer, mode)
466
+ 33016.3s 466  436 else:
467
+ 33016.3s 467  437 if 'w' in mode:
468
+ 33016.3s 468
469
+ 33016.3s 469 File /opt/conda/lib/python3.10/site-packages/torch/serialization.py:416, in _open_file.__init__(self, name, mode)
470
+ 33016.3s 470  415 def __init__(self, name, mode):
471
+ 33016.3s 471 --> 416 super().__init__(open(name, mode))
472
+ 33016.3s 472
473
+ 33016.3s 473 FileNotFoundError: [Errno 2] No such file or directory: '/kaggle/working/T5-en-vi-parameters.pth'
474
+ 33016.3s 474
475
+ 33018.6s 475 /opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py:2930: FutureWarning: --Exporter.preprocessors=["remove_papermill_header.RemovePapermillHeader"] for containers is deprecated in traitlets 5.0. You can pass `--Exporter.preprocessors item` ... multiple times to add items to a list.
476
+ 33018.6s 476 warn(
477
+ 33018.7s 477 [NbConvertApp] WARNING | Config option `kernel_spec_manager_class` not recognized by `NbConvertApp`.
478
+ 33018.7s 478 [NbConvertApp] Converting notebook __notebook__.ipynb to notebook
479
+ 33019.2s 479 [NbConvertApp] Writing 254414 bytes to __notebook__.ipynb
480
+ 33020.9s 480 /opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py:2930: FutureWarning: --Exporter.preprocessors=["nbconvert.preprocessors.ExtractOutputPreprocessor"] for containers is deprecated in traitlets 5.0. You can pass `--Exporter.preprocessors item` ... multiple times to add items to a list.
481
+ 33020.9s 481 warn(
482
+ 33020.9s 482 [NbConvertApp] WARNING | Config option `kernel_spec_manager_class` not recognized by `NbConvertApp`.
483
+ 33021.0s 483 [NbConvertApp] Converting notebook __notebook__.ipynb to html
484
+ 33022.1s 484 [NbConvertApp] Writing 511436 bytes to __results__.html
model/vi_en/Translation_en_vi_official/predict.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, Seq2SeqTrainer, Seq2SeqTrainingArguments, DataCollatorForSeq2Seq
3
+ import sacrebleu
4
+ from rouge_score import rouge_scorer
5
+ import numpy as np
6
+ import html
7
+ from datasets import Dataset
8
+ import pandas as pd
9
+
10
+ SRC = 'en'
11
+ TRG = 'vi'
12
+ KIND = 'official'
13
+
14
+ def load_file(file_path):
15
+ lang = []
16
+
17
+ with open(file_path, "r", encoding="utf-8") as file:
18
+ content_en = file.read()
19
+ lang += content_en.split('\n')
20
+ lang = [html.unescape(sent) for sent in lang]
21
+ return lang
22
+
23
+ #tải model:
24
+ name_model = f"NguyenManhAI/translation-{SRC}-{TRG}-{KIND}"
25
+ model = AutoModelForSeq2SeqLM.from_pretrained(name_model)
26
+ tokenizer = AutoTokenizer.from_pretrained(name_model)
27
+
28
+ list_test = dict()
29
+ list_test[SRC] = load_file(f"../data/test/{SRC}-2013.{SRC}")
30
+ list_test[TRG] = load_file(f"../data/test/{TRG}-2013.{TRG}")
31
+
32
+ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
33
+ def predict(model, input_sentence, tokenizer):
34
+ # Dịch một câu hoàn chỉnh
35
+ # Token hóa câu đầu vào
36
+ inputs = tokenizer(input_sentence, return_tensors="pt", padding=True, truncation=True).to(device)
37
+
38
+ # Sử dụng mô hình để dự đoán
39
+ with torch.no_grad():
40
+ outputs = model.generate(**inputs, max_new_tokens = 50)
41
+
42
+ # Giải mã đầu ra của mô hình
43
+ translated_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True)
44
+ return translated_sentence
45
+
46
+ if __name__ == "__main__":
47
+ sentence = {
48
+ 'en': "I'm a doctor and so he is",
49
+ 'vi': "Tôi là một bác sĩ và anh ấy cũng vậy."
50
+ }
51
+
52
+ pred = predict(model, sentence[SRC], tokenizer)
53
+ print(pred)
54
+
55
+ translation = {
56
+ 'inputs':[],
57
+ 'preds':[],
58
+ 'labels':[]
59
+ }
60
+
61
+ for i in range(len(list_test[SRC])):
62
+ translation['inputs'].append(list_test[SRC][i])
63
+ translation['preds'].append(predict(model, list_test[SRC][i], tokenizer))
64
+ translation['labels'].append(list_test[TRG][i])
65
+
66
+ # Tính BLEU
67
+ bleu = sacrebleu.corpus_bleu(translation['preds'], [translation['labels']])
68
+ # Tính TER
69
+ ter = sacrebleu.corpus_ter(translation['preds'], [translation['labels']])
70
+ # Tính CHRF
71
+ chrf = sacrebleu.corpus_chrf(translation['preds'], [translation['labels']])
72
+
73
+ # Tính ROUGE
74
+ scorer = rouge_scorer.RougeScorer(['rouge1', 'rougeL'], use_stemmer=True)
75
+ rouge1_scores = []
76
+ rougeL_scores = []
77
+ for pred, label in zip(translation['preds'], translation['labels']):
78
+ scores = scorer.score(pred, label)
79
+ rouge1_scores.append(scores['rouge1'].fmeasure)
80
+ rougeL_scores.append(scores['rougeL'].fmeasure)
81
+
82
+ avg_rouge1 = sum(rouge1_scores) / len(rouge1_scores)
83
+ avg_rougeL = sum(rougeL_scores) / len(rougeL_scores)
84
+
85
+ metric_str = f"bleu\tter\tchrf\trouge1\trougeL\n{bleu.score}\t{ter.score}\t{chrf.score}\t{avg_rouge1}\t{avg_rougeL}"
86
+
87
+ f = open('final-result\metric.txt', 'w', encoding='utf-8')
88
+ f.write(metric_str)
89
+ f.close()
90
+
91
+ pd.DataFrame(translation).to_csv('final-result/translation.csv', index=False)
92
+
93
+ print("Lưu thành công")
model/vi_en/Translation_en_vi_official/result/eval-bleu.png ADDED
model/vi_en/Translation_en_vi_official/result/eval-loss.png ADDED
model/vi_en/Translation_en_vi_official/result/eval-rougeL.png ADDED
model/vi_en/Translation_en_vi_official/result/eval-ter.png ADDED
model/vi_en/Translation_en_vi_official/result/log-step.csv ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Step Training Loss Validation Loss Bleu Ter Rouge1 Rougel
2
+ 250 0.419000 0.290262 34.528427 52.313225 0.752548 0.678462
3
+ 500 0.326400 0.286587 34.800746 52.096158 0.756820 0.681762
4
+ 750 0.315700 0.284458 34.896314 52.173913 0.754367 0.679986
5
+ 1000 0.318800 0.284286 34.799413 51.976285 0.752091 0.679039
6
+ 1250 0.315800 0.283449 35.001685 52.047560 0.755533 0.681133
7
+ 1500 0.316300 0.283837 34.437615 52.533532 0.751946 0.677418
8
+ 1750 0.311000 0.283472 35.142027 51.914728 0.755751 0.682285
9
+ 2000 0.313600 0.282538 34.885734 52.180393 0.754830 0.680829
10
+ 2250 0.309500 0.282026 35.073395 52.209551 0.753928 0.680840
11
+ 2500 0.306900 0.282315 35.002420 51.730059 0.756302 0.682668
12
+ 2750 0.310000 0.281654 35.056495 51.846692 0.754232 0.680863
13
+ 3000 0.311000 0.281669 34.930082 52.083198 0.753351 0.679717
14
+ 3250 0.311700 0.281589 34.891642 52.047560 0.755611 0.680720
15
+ 3500 0.303900 0.281686 34.820813 52.381261 0.755245 0.680496
16
+ 3750 0.305800 0.282299 34.703310 52.335904 0.754166 0.679429
17
+ 4000 0.305000 0.282130 34.979070 51.930927 0.754864 0.681688
18
+ 4250 0.303900 0.282648 34.665182 52.216031 0.755878 0.681373
19
+ 4500 0.284700 0.282799 34.779346 52.177153 0.755151 0.681280
20
+ 4750 0.283500 0.282231 34.575636 52.329424 0.755291 0.681444
21
+ 5000 0.287800 0.282950 35.066532 52.066999 0.754510 0.681349
22
+ 5250 0.282400 0.282641 34.738046 52.449297 0.755078 0.680114
23
+ 5500 0.281700 0.282985 35.103704 52.115596 0.755229 0.681769
24
+ 5750 0.285000 0.282623 34.993686 52.284067 0.753834 0.680014
25
+ 6000 0.284600 0.282732 34.879166 52.342383 0.753729 0.678728
26
+ 6250 0.288300 0.282963 34.786185 52.180393 0.754459 0.680658
27
+ 6500 0.282700 0.283174 34.787738 52.455777 0.752326 0.677820
28
+ 6750 0.285800 0.283622 34.780553 52.251669 0.754848 0.681448
29
+ 7000 0.282800 0.283338 34.545524 52.501134 0.753185 0.678880
30
+ 7250 0.285000 0.283650 34.594956 52.309985 0.753798 0.678729
31
+ 7500 0.288100 0.283284 34.584192 52.378021 0.753605 0.678208
32
+ 7750 0.283700 0.283334 34.755656 52.527052 0.754393 0.679484
33
+ 8000 0.288500 0.282929 34.863770 52.089678 0.754177 0.679090
34
+ 8250 0.286300 0.283118 35.015418 52.018402 0.755364 0.680887
35
+ 8500 0.274100 0.284133 34.665336 52.400700 0.754226 0.679405
36
+ 8750 0.266800 0.283913 34.747132 52.335904 0.755003 0.680039
37
+ 9000 0.268800 0.284677 34.894368 52.099397 0.756494 0.682901
38
+ 9250 0.266900 0.284614 34.798972 52.559451 0.753165 0.678783
39
+ 9500 0.261400 0.283952 35.032759 52.099397 0.755384 0.682476
40
+ 9750 0.273800 0.284692 34.647750 52.141515 0.752620 0.678391
41
+ 10000 0.264200 0.284589 34.573400 52.420139 0.753112 0.679655
42
+ 10250 0.264800 0.285057 34.698798 52.556211 0.752907 0.678781
43
+ 10500 0.266300 0.285633 34.764845 52.290546 0.754206 0.679841
44
+ 10750 0.269000 0.285177 34.831377 52.186872 0.753278 0.679870
45
+ 11000 0.268700 0.285041 35.051000 52.122076 0.753716 0.681443
46
+ 11250 0.269200 0.285213 34.793976 52.442817 0.752470 0.678178
47
+ 11500 0.270100 0.285189 34.979456 52.128556 0.755153 0.680690
48
+ 11750 0.268300 0.285230 34.803290 52.459016 0.753642 0.679593
49
+ 12000 0.273900 0.285383 34.772534 52.449297 0.753267 0.679359
50
+ 12250 0.265500 0.284756 34.976720 52.196592 0.753488 0.680104
51
+ 12500 0.268600 0.284991 34.625025 52.711722 0.751160 0.676630
52
+ 12750 0.249300 0.285994 34.644483 52.429858 0.752471 0.678399
53
+ 13000 0.247200 0.286402 34.472728 52.481695 0.752041 0.677051
54
+ 13250 0.253100 0.285756 34.495794 52.378021 0.753062 0.679352
55
+ 13500 0.256200 0.286078 34.659761 52.271107 0.754002 0.679929
56
+ 13750 0.251700 0.286377 34.811811 52.011923 0.755171 0.681603
57
+ 14000 0.252300 0.286590 34.628583 52.180393 0.752986 0.678800
58
+ 14250 0.254900 0.285408 34.779966 52.122076 0.753706 0.679666
59
+ 14500 0.255900 0.285430 34.523533 52.517333 0.751732 0.676663
60
+ 14750 0.256300 0.286176 34.711407 52.559451 0.751216 0.676992
61
+ 15000 0.257000 0.285813 34.657526 52.608048 0.751954 0.678795
62
+ 15250 0.257300 0.286247 34.357185 52.883432 0.751354 0.678527
63
+ 15500 0.256600 0.286103 34.516887 52.407179 0.751949 0.678904
64
+ 15750 0.257800 0.285732 34.663972 52.394220 0.752979 0.679021
65
+ 16000 0.255700 0.285848 34.811322 52.251669 0.753607 0.681053
66
+ 16250 0.251800 0.286037 34.781994 52.238709 0.754066 0.680860
67
+ 16500 0.254200 0.286227 34.613614 52.507614 0.753560 0.679909
68
+ 16750 0.252700 0.287012 34.593908 52.552971 0.752336 0.678807
69
+ 17000 0.237300 0.287675 34.563800 52.436338 0.752185 0.678338
70
+ 17250 0.244100 0.287874 34.516444 52.339143 0.752009 0.678697
71
+ 17500 0.244100 0.287712 34.716501 52.212791 0.753928 0.680122
72
+ 17750 0.245200 0.288067 34.446680 52.572410 0.750473 0.676645
73
+ 18000 0.239800 0.288097 34.605238 52.533532 0.752129 0.678389
74
+ 18250 0.243700 0.287283 34.812002 52.274347 0.754477 0.681288
75
+ 18500 0.244600 0.288129 34.739062 52.193352 0.751838 0.678736
76
+ 18750 0.245300 0.287901 34.623221 52.663124 0.752117 0.678288
77
+ 19000 0.239600 0.288192 34.536433 52.556211 0.752236 0.678925
78
+ 19250 0.247400 0.287871 34.466079 52.549731 0.751615 0.678723
79
+ 19500 0.244500 0.288099 34.710327 52.309985 0.753673 0.680532
80
+ 19750 0.245100 0.287870 34.630253 52.598328 0.751851 0.679287
81
+ 20000 0.243900 0.288536 34.644793 52.484935 0.752480 0.679749
82
+ 20250 0.246600 0.287813 34.587763 52.585369 0.752426 0.679073
83
+ 20500 0.245200 0.287937 34.681474 52.339143 0.754259 0.680305
84
+ 20750 0.241800 0.287583 34.395582 52.591849 0.752626 0.679396
85
+ 21000 0.238400 0.288713 34.563898 52.436338 0.751552 0.678410
86
+ 21250 0.234200 0.288712 34.483443 52.381261 0.752208 0.678948
87
+ 21500 0.232500 0.288679 34.650391 52.290546 0.753767 0.680581
88
+ 21750 0.232600 0.288971 34.442432 52.540012 0.751720 0.678481
89
+ 22000 0.233400 0.288925 34.569535 52.562690 0.752625 0.678821
90
+ 22250 0.238600 0.289514 34.551436 52.381261 0.751440 0.677981
91
+ 22500 0.234200 0.289626 34.441588 52.497894 0.751520 0.677585
92
+ 22750 0.233900 0.289363 34.593922 52.439578 0.752512 0.679121
93
+ 23000 0.232200 0.289463 34.525191 52.481695 0.753027 0.679459
94
+ 23250 0.234300 0.289507 34.432297 52.630726 0.752456 0.678347
95
+ 23500 0.234600 0.289515 34.576305 52.423378 0.755927 0.681484
96
+ 23750 0.235400 0.289634 34.493307 52.361822 0.753436 0.679981
97
+ 24000 0.236600 0.289308 34.508890 52.501134 0.752473 0.678877
98
+ 24250 0.235800 0.289545 34.454653 52.643686 0.752118 0.678529
99
+ 24500 0.235900 0.289539 34.631501 52.400700 0.752927 0.679502
100
+ 24750 0.235300 0.289798 34.594740 52.543251 0.752297 0.678988
101
+ 25000 0.239200 0.289250 34.487818 52.426618 0.754231 0.680105
102
+ 25250 0.223000 0.290312 34.649519 52.540012 0.753576 0.680114
103
+ 25500 0.228500 0.290456 34.528229 52.455777 0.754807 0.680595
104
+ 25750 0.229200 0.290738 34.640926 52.371542 0.751684 0.678085
105
+ 26000 0.228300 0.291240 34.449279 52.552971 0.752228 0.678339
106
+ 26250 0.227600 0.291488 34.345595 52.530292 0.752314 0.678304
107
+ 26500 0.226800 0.291294 34.311404 52.633966 0.751529 0.677572
108
+ 26750 0.225400 0.290639 34.451373 52.546491 0.751783 0.678674
109
+ 27000 0.225400 0.291197 34.387727 52.504374 0.751414 0.678172
110
+ 27250 0.226500 0.291320 34.485161 52.552971 0.751665 0.678004
111
+ 27500 0.226300 0.290772 34.589606 52.459016 0.752079 0.679519
112
+ 27750 0.226100 0.291098 34.361585 52.488175 0.752428 0.678358
113
+ 28000 0.228800 0.291129 34.326145 52.410419 0.754117 0.680403
114
+ 28250 0.228100 0.291153 34.519491 52.400700 0.753561 0.680261
115
+ 28500 0.228400 0.290862 34.305193 52.679324 0.752277 0.678830
116
+ 28750 0.227300 0.291258 34.467356 52.595088 0.753575 0.679180
117
+ 29000 0.232900 0.291031 34.559018 52.468736 0.753631 0.679671
118
+ 29250 0.224300 0.291368 34.560449 52.494654 0.753912 0.678687
119
+ 29500 0.216400 0.292063 34.517452 52.517333 0.754512 0.679899
120
+ 29750 0.219100 0.292350 34.500112 52.523813 0.752534 0.678793
121
+ 30000 0.219200 0.292020 34.664747 52.345623 0.754454 0.680843
122
+ 30250 0.219400 0.292669 34.488506 52.206311 0.753417 0.679643
123
+ 30500 0.220600 0.292113 34.604324 52.452537 0.753472 0.679928
124
+ 30750 0.222800 0.292533 34.350358 52.556211 0.752131 0.678221
125
+ 31000 0.218700 0.292380 34.486867 52.452537 0.752675 0.678633
126
+ 31250 0.222200 0.292313 34.588149 52.439578 0.753715 0.680198
127
+ 31500 0.222200 0.292347 34.375924 52.695523 0.752555 0.678755
128
+ 31750 0.223300 0.292704 34.617165 52.514093 0.752208 0.679307
129
+ 32000 0.221300 0.292315 34.383206 52.523813 0.752533 0.678352
130
+ 32250 0.221700 0.292228 34.433439 52.536772 0.752186 0.677860
131
+ 32500 0.225100 0.292700 34.333668 52.663124 0.752301 0.678470
132
+ 32750 0.225300 0.292077 34.401373 52.666364 0.753154 0.679202
133
+ 33000 0.226100 0.292253 34.300853 52.578889 0.751793 0.678611
134
+ 33250 0.221700 0.292295 34.337892 52.591849 0.752481 0.678538
135
+ 33500 0.220700 0.292421 34.275865 52.637206 0.752148 0.678261
136
+ 33750 0.214800 0.292514 34.368292 52.689043 0.751829 0.677967
137
+ 34000 0.216600 0.293029 34.329284 52.702002 0.751709 0.677994
138
+ 34250 0.215900 0.293012 34.525349 52.556211 0.751295 0.677877
139
+ 34500 0.217700 0.292965 34.416318 52.510853 0.751597 0.678574
140
+ 34750 0.216000 0.293103 34.362141 52.543251 0.752105 0.678586
141
+ 35000 0.219800 0.293020 34.547682 52.410419 0.752500 0.679620
142
+ 35250 0.221200 0.293055 34.443104 52.510853 0.752530 0.679353
143
+ 35500 0.216000 0.293053 34.273942 52.663124 0.751054 0.677627
144
+ 35750 0.216500 0.293292 34.302071 52.536772 0.751861 0.677793
145
+ 36000 0.216000 0.293259 34.419504 52.507614 0.751413 0.677874
146
+ 36250 0.215300 0.293047 34.386519 52.471976 0.751828 0.677827
147
+ 36500 0.216000 0.293291 34.353553 52.533532 0.752023 0.678451
148
+ 36750 0.219300 0.293247 34.449875 52.514093 0.751933 0.678079
149
+ 37000 0.214600 0.293311 34.373529 52.562690 0.751991 0.678362
150
+ 37250 0.217000 0.293330 34.427029 52.608048 0.751084 0.677297
151
+ 37500 0.219200 0.293212 34.636159 52.510853 0.751741 0.678528
152
+ 37750 0.210000 0.293555 34.521696 52.446057 0.752653 0.679411
153
+ 38000 0.210900 0.293689 34.564794 52.569170 0.751889 0.678274
154
+ 38250 0.218000 0.293487 34.488335 52.588609 0.752255 0.679032
155
+ 38500 0.211200 0.293674 34.479109 52.617767 0.752243 0.679262
156
+ 38750 0.217300 0.293676 34.442394 52.501134 0.752282 0.679276
157
+ 39000 0.212500 0.293607 34.462774 52.468736 0.752388 0.679002
158
+ 39250 0.215600 0.293675 34.379423 52.510853 0.752624 0.679402
159
+ 39500 0.211600 0.293567 34.462554 52.514093 0.752719 0.679225
160
+ 39750 0.210400 0.293551 34.430552 52.484935 0.752396 0.678942
161
+ 40000 0.213100 0.293576 34.437984 52.510853 0.752562 0.678946
162
+ 40250 0.216200 0.293517 34.431053 52.565930 0.753121 0.679380
163
+ 40500 0.213100 0.293545 34.466043 52.494654 0.752099 0.678525
164
+ 40750 0.211100 0.293575 34.501940 52.543251 0.752207 0.678912
165
+ 41000 0.218000 0.293595 34.494352 52.488175 0.752383 0.679068
166
+ 41250 0.218100 0.293574 34.495723 52.533532 0.752160 0.678757
167
+ 41500 0.213100 0.293587 34.509502 52.559451 0.752252 0.678877
model/vi_en/Translation_en_vi_official/result/rouge1.png ADDED
model/vi_en/Translation_en_vi_official/result/train-loss.png ADDED
model/vi_en/Translation_en_vi_official/train.py ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, Seq2SeqTrainer, Seq2SeqTrainingArguments, DataCollatorForSeq2Seq
3
+ import sacrebleu
4
+ from rouge_score import rouge_scorer
5
+ import numpy as np
6
+ import html
7
+ from datasets import Dataset
8
+
9
+ SRC = 'en'
10
+ TRG = 'vi'
11
+ KIND = 'official'
12
+ name_model = "Helsinki-NLP/opus-mt-vi-en"
13
+
14
+ # load dữ liệu
15
+ def load_file(file_path):
16
+ lang = []
17
+
18
+ with open(file_path, "r", encoding="utf-8") as file:
19
+ content_en = file.read()
20
+ lang += content_en.split('\n')
21
+ lang = [html.unescape(sent) for sent in lang]
22
+ return lang
23
+
24
+ list_train = dict()
25
+ list_train[SRC] = load_file(f"../data/train/{SRC}.{SRC}")
26
+ list_train[TRG] = load_file(f"../data/train/{TRG}.{TRG}")
27
+
28
+ list_test = dict()
29
+ list_test[SRC] = load_file(f"../data/test/{SRC}-2013.{SRC}")
30
+ list_test[TRG] = load_file(f"../data/test/{TRG}-2013.{TRG}")
31
+
32
+ list_dev = dict()
33
+ list_dev[SRC] = load_file(f"../data/dev/{SRC}-2012.{SRC}")
34
+ list_dev[TRG] = load_file(f"../data/dev/{TRG}-2012.{TRG}")
35
+
36
+
37
+ dataset_train = Dataset.from_dict({"source": list_train[SRC], "target": list_train})
38
+ dataset_test = Dataset.from_dict({"source": list_test[SRC], "target": list_test[TRG]})
39
+ dataset_dev = Dataset.from_dict({"source": list_dev[SRC], "target": list_dev[TRG]})
40
+
41
+ #tải model:
42
+ model = AutoModelForSeq2SeqLM.from_pretrained(name_model)
43
+ tokenizer = AutoTokenizer.from_pretrained(name_model)
44
+
45
+ #tạo các phương thức cần thiết:
46
+ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
47
+ def predict(model, input_sentence, tokenizer):
48
+ # Dịch một câu hoàn chỉnh
49
+ # Token hóa câu đầu vào
50
+ inputs = tokenizer(input_sentence, return_tensors="pt", padding=True, truncation=True).to(device)
51
+
52
+ # Sử dụng mô hình để dự đoán
53
+ with torch.no_grad():
54
+ outputs = model.generate(**inputs, max_new_tokens = 50)
55
+
56
+ # Giải mã đầu ra của mô hình
57
+ translated_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True)
58
+ return translated_sentence
59
+
60
+ def tokenize_function(examples):
61
+ inputs = [ex for ex in examples['source']]
62
+ targets = [ex for ex in examples['target']]
63
+ model_inputs = tokenizer(inputs, max_length=80, truncation=True, padding="max_length") #80 -> 128
64
+
65
+ # Sử dụng tokenizer để mã hóa câu đích
66
+ with tokenizer.as_target_tokenizer():
67
+ labels = tokenizer(text_target = targets, max_length=80, truncation=True, padding="max_length") # 80 -> 128
68
+
69
+ # Thêm nhãn vào kết quả mã hóa
70
+ model_inputs["labels"] = labels["input_ids"]
71
+
72
+ return model_inputs
73
+
74
+ def compute_metrics(eval_pred):
75
+ predictions, labels = eval_pred
76
+
77
+ predictions = np.array(predictions)
78
+ predictions[predictions < 0] = 0
79
+ predictions = predictions.tolist()
80
+
81
+
82
+ labels = np.array(labels)
83
+ labels[labels < 0] = 0
84
+ labels = labels.tolist()
85
+
86
+ decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=True)
87
+ decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)
88
+
89
+ # Tính BLEU
90
+ bleu = sacrebleu.corpus_bleu(decoded_preds, [decoded_labels])
91
+
92
+ # Tính TER
93
+ ter = sacrebleu.corpus_ter(decoded_preds, [decoded_labels])
94
+
95
+ # Tính CHRF
96
+ chrf = sacrebleu.corpus_chrf(decoded_preds, [decoded_labels])
97
+
98
+ # Tính ROUGE
99
+ scorer = rouge_scorer.RougeScorer(['rouge1', 'rougeL'], use_stemmer=True)
100
+ rouge1_scores = []
101
+ rougeL_scores = []
102
+ for pred, label in zip(decoded_preds, decoded_labels):
103
+ scores = scorer.score(pred, label)
104
+ rouge1_scores.append(scores['rouge1'].fmeasure)
105
+ rougeL_scores.append(scores['rougeL'].fmeasure)
106
+
107
+ avg_rouge1 = sum(rouge1_scores) / len(rouge1_scores)
108
+ avg_rougeL = sum(rougeL_scores) / len(rougeL_scores)
109
+
110
+ return {
111
+ "bleu": bleu.score,
112
+ "ter": ter.score,
113
+ "chrf": chrf.score,
114
+ "rouge1": avg_rouge1,
115
+ "rougeL": avg_rougeL
116
+ }
117
+
118
+ # chuẩn bị dữ liệu:
119
+ tokenized_train = dataset_train.map(tokenize_function, batched=True)
120
+ tokenized_test = dataset_test.map(tokenize_function, batched=True)
121
+
122
+ data_collator = DataCollatorForSeq2Seq(tokenizer, model=model)
123
+
124
+ # thiết lập callback
125
+
126
+ from transformers import TrainerCallback
127
+
128
+ class CustomStepCallback(TrainerCallback):
129
+ def __init__(self, steps_interval, action_method):
130
+ self.steps_interval = steps_interval
131
+ self.action_method = action_method
132
+
133
+ def on_step_end(self, args, state, control, **kwargs):
134
+ # Thực hiện hành động sau mỗi steps_interval bước
135
+ if state.global_step % self.steps_interval == 0:
136
+ self.action_method(state.global_step)
137
+
138
+ # Định nghĩa phương thức hành động
139
+ def custom_action(step):
140
+ sentence = {
141
+ 'vi': "Chúng tôi là những bác sĩ xuất sắc và anh ấy cũng vậy, do đó ca phẫu thuật chắc chắn sẽ thành công.",
142
+ 'en': "We are excellent doctors and so is he, so the surgery will definitely be successful."
143
+ }
144
+ pred = predict(model, sentence[SRC], tokenizer)
145
+ print(f"Translated: {pred}")
146
+
147
+ # Khởi tạo callback với số bước và phương thức hành động
148
+ custom_callback = CustomStepCallback(steps_interval=1000, action_method=custom_action)
149
+
150
+ # thiết lập huấn luyện
151
+ training_args = Seq2SeqTrainingArguments(
152
+ output_dir=f"./results-{SRC}-{TRG}-base",
153
+ evaluation_strategy="steps",
154
+ eval_steps=250, #100 -> 250 x
155
+ learning_rate=3e-5, #3 -> 2
156
+ per_device_train_batch_size=16, #8 -> 16
157
+ per_device_eval_batch_size=16, #8 -> 16
158
+ weight_decay=0.01,
159
+ save_total_limit=3,
160
+ num_train_epochs=10, # 1 -> 10 x
161
+ predict_with_generate=True,
162
+ generation_max_length=50,
163
+ save_steps=500,
164
+ logging_dir="./logs", # Thư mục để lưu logs
165
+ logging_steps=250,
166
+ fp16 = True
167
+ )
168
+
169
+ trainer = Seq2SeqTrainer(
170
+ model=model,
171
+ args=training_args,
172
+ train_dataset=tokenized_train, #dev -> train x
173
+ eval_dataset=tokenized_test,
174
+ tokenizer=tokenizer,
175
+ data_collator=data_collator,
176
+ compute_metrics=compute_metrics,
177
+ callbacks=[custom_callback]
178
+ )
179
+
180
+ if __name__ == "__main__":
181
+ # huấn luyện và lưu lại mô hình
182
+ trainer.train()
183
+ torch.save(model.state_dict(), f"{SRC}-{TRG}-parameters-{KIND}.pth")
model/vi_en/Translation_en_vi_transformer/log/transformer-scratch.log ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 8.8s 1 Collecting sacrebleu
2
+ 8.8s 2 Downloading sacrebleu-2.4.2-py3-none-any.whl.metadata (58 kB)
3
+ 8.8s 3 [?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/58.0 kB ? eta -:--:--
4
+ 8.9s 4 [?25hCollecting portalocker (from sacrebleu)
5
+ 8.9s 5 Downloading portalocker-2.10.1-py3-none-any.whl.metadata (8.5 kB)
6
+ 8.9s 6 Requirement already satisfied: regex in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (2023.12.25)
7
+ 8.9s 7 Requirement already satisfied: tabulate>=0.8.9 in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (0.9.0)
8
+ 8.9s 8 Requirement already satisfied: numpy>=1.17 in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (1.26.4)
9
+ 8.9s 9 Requirement already satisfied: colorama in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (0.4.6)
10
+ 8.9s 10 Requirement already satisfied: lxml in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (5.2.2)
11
+ 9.0s 11 Downloading sacrebleu-2.4.2-py3-none-any.whl (106 kB)
12
+ 9.0s 12 [?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/106.7 kB ? eta -:--:--
13
+ 9.0s 13 [?25hDownloading portalocker-2.10.1-py3-none-any.whl (18 kB)
14
+ 19.8s 14 Installing collected packages: portalocker, sacrebleu
15
+ 20.1s 15 Successfully installed portalocker-2.10.1 sacrebleu-2.4.2
16
+ 21.4s 16 Collecting rouge_score
17
+ 21.5s 17 Downloading rouge_score-0.1.2.tar.gz (17 kB)
18
+ 22.5s 18 Preparing metadata (setup.py) ... [?25l- done
19
+ 22.5s 19 [?25hRequirement already satisfied: absl-py in /opt/conda/lib/python3.10/site-packages (from rouge_score) (1.4.0)
20
+ 22.5s 20 Requirement already satisfied: nltk in /opt/conda/lib/python3.10/site-packages (from rouge_score) (3.2.4)
21
+ 22.5s 21 Requirement already satisfied: numpy in /opt/conda/lib/python3.10/site-packages (from rouge_score) (1.26.4)
22
+ 22.5s 22 Requirement already satisfied: six>=1.14.0 in /opt/conda/lib/python3.10/site-packages (from rouge_score) (1.16.0)
23
+ 22.6s 23 Building wheels for collected packages: rouge_score
24
+ 23.9s 24 Building wheel for rouge_score (setup.py) ... [?25l- \ done
25
+ 23.9s 25 [?25h Created wheel for rouge_score: filename=rouge_score-0.1.2-py3-none-any.whl size=24934 sha256=ed16ec7d76f2c23c099684feb5cb007f77b14876267d0424da52ec34b06ad122
26
+ 23.9s 26 Stored in directory: /root/.cache/pip/wheels/5f/dd/89/461065a73be61a532ff8599a28e9beef17985c9e9c31e541b4
27
+ 24.0s 27 Successfully built rouge_score
28
+ 34.0s 28 Installing collected packages: rouge_score
29
+ 34.2s 29 Successfully installed rouge_score-0.1.2
30
+ 35.6s 30 Collecting underthesea
31
+ 35.6s 31 Downloading underthesea-6.8.4-py3-none-any.whl.metadata (15 kB)
32
+ 35.7s 32 Requirement already satisfied: Click>=6.0 in /opt/conda/lib/python3.10/site-packages (from underthesea) (8.1.7)
33
+ 35.7s 33 Collecting python-crfsuite>=0.9.6 (from underthesea)
34
+ 35.7s 34 Downloading python_crfsuite-0.9.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.2 kB)
35
+ 35.8s 35 Requirement already satisfied: nltk in /opt/conda/lib/python3.10/site-packages (from underthesea) (3.2.4)
36
+ 35.8s 36 Requirement already satisfied: tqdm in /opt/conda/lib/python3.10/site-packages (from underthesea) (4.66.4)
37
+ 35.8s 37 Requirement already satisfied: requests in /opt/conda/lib/python3.10/site-packages (from underthesea) (2.32.3)
38
+ 35.8s 38 Requirement already satisfied: joblib in /opt/conda/lib/python3.10/site-packages (from underthesea) (1.4.2)
39
+ 35.8s 39 Requirement already satisfied: scikit-learn in /opt/conda/lib/python3.10/site-packages (from underthesea) (1.2.2)
40
+ 35.8s 40 Requirement already satisfied: PyYAML in /opt/conda/lib/python3.10/site-packages (from underthesea) (6.0.1)
41
+ 35.9s 41 Collecting underthesea-core==1.0.4 (from underthesea)
42
+ 35.9s 42 Downloading underthesea_core-1.0.4-cp310-cp310-manylinux2010_x86_64.whl.metadata (1.7 kB)
43
+ 35.9s 43 Requirement already satisfied: six in /opt/conda/lib/python3.10/site-packages (from nltk->underthesea) (1.16.0)
44
+ 35.9s 44 Requirement already satisfied: charset-normalizer<4,>=2 in /opt/conda/lib/python3.10/site-packages (from requests->underthesea) (3.3.2)
45
+ 35.9s 45 Requirement already satisfied: idna<4,>=2.5 in /opt/conda/lib/python3.10/site-packages (from requests->underthesea) (3.6)
46
+ 35.9s 46 Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/conda/lib/python3.10/site-packages (from requests->underthesea) (1.26.18)
47
+ 35.9s 47 Requirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.10/site-packages (from requests->underthesea) (2024.7.4)
48
+ 36.0s 48 Requirement already satisfied: numpy>=1.17.3 in /opt/conda/lib/python3.10/site-packages (from scikit-learn->underthesea) (1.26.4)
49
+ 36.0s 49 Requirement already satisfied: scipy>=1.3.2 in /opt/conda/lib/python3.10/site-packages (from scikit-learn->underthesea) (1.11.4)
50
+ 36.0s 50 Requirement already satisfied: threadpoolctl>=2.0.0 in /opt/conda/lib/python3.10/site-packages (from scikit-learn->underthesea) (3.2.0)
51
+ 36.1s 51 Downloading underthesea-6.8.4-py3-none-any.whl (20.9 MB)
52
+ 36.3s 52 [?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/20.9 MB ? eta -:--:--
53
+ 36.3s 53 [?25hDownloading underthesea_core-1.0.4-cp310-cp310-manylinux2010_x86_64.whl (657 kB)
54
+ 36.3s 54 [?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/657.8 kB ? eta -:--:--
55
+ 36.3s 55 [?25hDownloading python_crfsuite-0.9.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB)
56
+ 36.4s 56 [?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/1.1 MB ? eta -:--:--
57
+ 46.4s 57 [?25hInstalling collected packages: underthesea-core, python-crfsuite, underthesea
58
+ 47.2s 58 Successfully installed python-crfsuite-0.9.10 underthesea-6.8.4 underthesea-core-1.0.4
59
+ 47.7s 59 Note: you may need to restart the kernel to use updated packages.
60
+ 61.3s 60 /opt/conda/lib/python3.10/site-packages/torch/nn/modules/transformer.py:282: UserWarning: enable_nested_tensor is True, but self.use_nested_tensor is False because encoder_layer.self_attn.batch_first was not True(use batch_first for better inference performance)
61
+ 61.3s 61 warnings.warn(f"enable_nested_tensor is True, but self.use_nested_tensor is False because {why_not_sparsity_fast_path}")
62
+ 65.3s 62 /opt/conda/lib/python3.10/site-packages/torch/nn/functional.py:5076: UserWarning: Support for mismatched key_padding_mask and attn_mask is deprecated. Use same type for both instead.
63
+ 65.3s 63 warnings.warn(
64
+ 117.3s 64 Step: 21.322%, Train loss: 8.202, Val loss: 6.663, time: 0p52s
65
+ 169.5s 65 Step: 42.644%, Train loss: 7.419, Val loss: 6.478, time: 0p52s
66
+ 220.3s 66 Step: 63.966%, Train loss: 7.079, Val loss: 6.394, time: 0p50s
67
+ 269.9s 67 Step: 85.288%, Train loss: 6.877, Val loss: 6.215, time: 0p49s
68
+ 546.3s 68 Và là là là là là là là là là
69
+ 546.3s 69 Epoch: 1, Train loss: 6.769, Val loss: 6.157, Bleu: 0.000, Ter: 115.626, CHRF: 1.976, Rough1: 0.008, RoughL: 0.008, Epoch time: 481.781s
70
+ 597.5s 70 Step: 21.322%, Train loss: 6.064, Val loss: 6.093, time: 0p51s
71
+ 649.3s 71 Step: 42.644%, Train loss: 6.050, Val loss: 6.030, time: 0p51s
72
+ 699.9s 72 Step: 63.966%, Train loss: 6.008, Val loss: 6.075, time: 0p50s
73
+ 749.5s 73 Step: 85.288%, Train loss: 5.972, Val loss: 5.976, time: 0p49s
74
+ 1014.0s 74 Và bạn là một người .
75
+ 1014.0s 75 Epoch: 2, Train loss: 5.941, Val loss: 5.945, Bleu: 0.000, Ter: 117.615, CHRF: 3.267, Rough1: 0.019, RoughL: 0.019, Epoch time: 467.688s
76
+ 1065.1s 76 Step: 21.322%, Train loss: 5.758, Val loss: 5.902, time: 0p51s
77
+ 1117.1s 77 Step: 42.644%, Train loss: 5.753, Val loss: 5.873, time: 0p51s
78
+ 1167.5s 78 Step: 63.966%, Train loss: 5.717, Val loss: 5.907, time: 0p50s
79
+ 1217.0s 79 Step: 85.288%, Train loss: 5.685, Val loss: 5.773, time: 0p49s
80
+ 1468.9s 80 Và tôi không ?
81
+ 1468.9s 81 Epoch: 3, Train loss: 5.659, Val loss: 5.825, Bleu: 0.000, Ter: 118.631, CHRF: 2.901, Rough1: 0.016, RoughL: 0.016, Epoch time: 454.850s
82
+ 1519.8s 82 Step: 21.322%, Train loss: 5.536, Val loss: 5.783, time: 0p50s
83
+ 1571.3s 83 Step: 42.644%, Train loss: 5.542, Val loss: 5.762, time: 0p51s
84
+ 1621.8s 84 Step: 63.966%, Train loss: 5.510, Val loss: 5.735, time: 0p50s
85
+ 1671.2s 85 Step: 85.288%, Train loss: 5.485, Val loss: 5.690, time: 0p49s
86
+ 1913.1s 86 Và tôi không ?
87
+ 1913.1s 87 Epoch: 4, Train loss: 5.463, Val loss: 5.704, Bleu: 0.000, Ter: 117.758, CHRF: 2.755, Rough1: 0.016, RoughL: 0.016, Epoch time: 444.210s
88
+ 1964.3s 88 Step: 21.322%, Train loss: 5.369, Val loss: 5.644, time: 0p51s
89
+ 2016.1s 89 Step: 42.644%, Train loss: 5.375, Val loss: 5.674, time: 0p51s
90
+ 2066.6s 90 Step: 63.966%, Train loss: 5.345, Val loss: 5.619, time: 0p50s
91
+ 2116.2s 91 Step: 85.288%, Train loss: 5.319, Val loss: 5.614, time: 0p49s
92
+ 2339.6s 92 Và tôi đã làm .
93
+ 2339.6s 93 Epoch: 5, Train loss: 5.298, Val loss: 5.578, Bleu: 0.000, Ter: 118.445, CHRF: 2.820, Rough1: 0.016, RoughL: 0.016, Epoch time: 426.542s
94
+ 2390.8s 94 Step: 21.322%, Train loss: 5.206, Val loss: 5.571, time: 0p51s
95
+ 2442.5s 95 Step: 42.644%, Train loss: 5.215, Val loss: 5.570, time: 0p51s
96
+ 2493.1s 96 Step: 63.966%, Train loss: 5.188, Val loss: 5.548, time: 0p50s
97
+ 2542.5s 97 Step: 85.288%, Train loss: 5.167, Val loss: 5.516, time: 0p49s
98
+ 2799.2s 98 Và tôi đã làm .
99
+ 2799.2s 99 Epoch: 6, Train loss: 5.148, Val loss: 5.480, Bleu: 0.000, Ter: 119.614, CHRF: 2.906, Rough1: 0.017, RoughL: 0.017, Epoch time: 459.528s
100
+ 2850.1s 100 Step: 21.322%, Train loss: 5.072, Val loss: 5.512, time: 0p50s
101
+ 2901.8s 101 Step: 42.644%, Train loss: 5.086, Val loss: 5.491, time: 0p51s
102
+ 2952.4s 102 Step: 63.966%, Train loss: 5.064, Val loss: 5.489, time: 0p50s
103
+ 3001.8s 103 Step: 85.288%, Train loss: 5.045, Val loss: 5.429, time: 0p49s
104
+ 3255.8s 104 Và tôi đã làm .
105
+ 3255.8s 105 Epoch: 7, Train loss: 5.027, Val loss: 5.424, Bleu: 0.000, Ter: 119.475, CHRF: 3.032, Rough1: 0.018, RoughL: 0.018, Epoch time: 456.665s
106
+ 3306.9s 106 Step: 21.322%, Train loss: 4.956, Val loss: 5.448, time: 0p51s
107
+ 3358.5s 107 Step: 42.644%, Train loss: 4.973, Val loss: 5.453, time: 0p51s
108
+ 3408.9s 108 Step: 63.966%, Train loss: 4.952, Val loss: 5.432, time: 0p50s
109
+ 3458.3s 109 Step: 85.288%, Train loss: 4.932, Val loss: 5.372, time: 0p49s
110
+ 3715.1s 110 Và đó là một thứ .
111
+ 3715.1s 111 Epoch: 8, Train loss: 4.913, Val loss: 5.338, Bleu: 0.000, Ter: 118.407, CHRF: 3.369, Rough1: 0.020, RoughL: 0.020, Epoch time: 459.261s
112
+ 3766.2s 112 Step: 21.322%, Train loss: 4.844, Val loss: 5.393, time: 0p51s
113
+ 3817.8s 113 Step: 42.644%, Train loss: 4.866, Val loss: 5.379, time: 0p51s
114
+ 3868.3s 114 Step: 63.966%, Train loss: 4.847, Val loss: 5.361, time: 0p50s
115
+ 3917.7s 115 Step: 85.288%, Train loss: 4.828, Val loss: 5.310, time: 0p49s
116
+ 4179.5s 116 Và nó là một thứ .
117
+ 4179.5s 117 Epoch: 9, Train loss: 4.808, Val loss: 5.297, Bleu: 0.000, Ter: 117.319, CHRF: 3.121, Rough1: 0.020, RoughL: 0.020, Epoch time: 464.396s
118
+ 4230.5s 118 Step: 21.322%, Train loss: 4.740, Val loss: 5.325, time: 0p51s
119
+ 4282.2s 119 Step: 42.644%, Train loss: 4.764, Val loss: 5.358, time: 0p51s
120
+ 4332.7s 120 Step: 63.966%, Train loss: 4.747, Val loss: 5.284, time: 0p50s
121
+ 4382.1s 121 Step: 85.288%, Train loss: 4.728, Val loss: 5.262, time: 0p49s
122
+ 4644.0s 122 Và họ đã làm được .
123
+ 4644.0s 123 Epoch: 10, Train loss: 4.711, Val loss: 5.245, Bleu: 0.000, Ter: 118.270, CHRF: 3.367, Rough1: 0.021, RoughL: 0.021, Epoch time: 464.559s
124
+ 4695.4s 124 Step: 21.322%, Train loss: 4.644, Val loss: 5.289, time: 0p51s
125
+ 4747.4s 125 Step: 42.644%, Train loss: 4.669, Val loss: 5.278, time: 0p52s
126
+ 4798.3s 126 Step: 63.966%, Train loss: 4.652, Val loss: 5.230, time: 0p50s
127
+ 4848.0s 127 Step: 85.288%, Train loss: 4.634, Val loss: 5.223, time: 0p49s
128
+ 5115.0s 128 Và đó là một thứ .
129
+ 5115.0s 129 Epoch: 11, Train loss: 4.619, Val loss: 5.221, Bleu: 0.000, Ter: 118.888, CHRF: 3.163, Rough1: 0.021, RoughL: 0.021, Epoch time: 470.965s
130
+ 5166.2s 130 Step: 21.322%, Train loss: 4.558, Val loss: 5.254, time: 0p51s
131
+ 5218.2s 131 Step: 42.644%, Train loss: 4.581, Val loss: 5.232, time: 0p51s
132
+ 5269.0s 132 Step: 63.966%, Train loss: 4.561, Val loss: 5.193, time: 0p50s
133
+ 5318.8s 133 Step: 85.288%, Train loss: 4.543, Val loss: 5.176, time: 0p49s
134
+ 5585.8s 134 Và họ đã bị mất .
135
+ 5585.8s 135 Epoch: 12, Train loss: 4.528, Val loss: 5.181, Bleu: 0.000, Ter: 119.485, CHRF: 3.076, Rough1: 0.020, RoughL: 0.020, Epoch time: 470.803s
136
+ 5637.0s 136 Step: 21.322%, Train loss: 4.471, Val loss: 5.214, time: 0p51s
137
+ 5689.0s 137 Step: 42.644%, Train loss: 4.491, Val loss: 5.211, time: 0p51s
138
+ 5739.7s 138 Step: 63.966%, Train loss: 4.471, Val loss: 5.178, time: 0p50s
139
+ 5789.3s 139 Step: 85.288%, Train loss: 4.452, Val loss: 5.144, time: 0p49s
140
+ 6056.2s 140 Ch��ng ta đã làm được .
141
+ 6056.2s 141 Epoch: 13, Train loss: 4.439, Val loss: 5.160, Bleu: 0.000, Ter: 118.703, CHRF: 3.752, Rough1: 0.025, RoughL: 0.025, Epoch time: 470.417s
142
+ 6107.6s 142 Step: 21.322%, Train loss: 4.374, Val loss: 5.166, time: 0p51s
143
+ 6159.5s 143 Step: 42.644%, Train loss: 4.394, Val loss: 5.152, time: 0p51s
144
+ 6210.2s 144 Step: 63.966%, Train loss: 4.377, Val loss: 5.161, time: 0p50s
145
+ 6259.9s 145 Step: 85.288%, Train loss: 4.361, Val loss: 5.125, time: 0p49s
146
+ 6523.9s 146 Chúng tôi đã làm được .
147
+ 6523.9s 147 Epoch: 14, Train loss: 4.350, Val loss: 5.109, Bleu: 0.000, Ter: 118.007, CHRF: 4.421, Rough1: 0.028, RoughL: 0.028, Epoch time: 467.668s
148
+ 6575.3s 148 Step: 21.322%, Train loss: 4.284, Val loss: 5.136, time: 0p51s
149
+ 6627.3s 149 Step: 42.644%, Train loss: 4.307, Val loss: 5.158, time: 0p51s
150
+ 6677.9s 150 Step: 63.966%, Train loss: 4.290, Val loss: 5.110, time: 0p50s
151
+ 6727.5s 151 Step: 85.288%, Train loss: 4.273, Val loss: 5.108, time: 0p49s
152
+ 6987.4s 152 Chúng tôi đã bị mất .
153
+ 6987.4s 153 Epoch: 15, Train loss: 4.260, Val loss: 5.037, Bleu: 0.000, Ter: 118.338, CHRF: 4.579, Rough1: 0.029, RoughL: 0.029, Epoch time: 463.444s
154
+ 7038.5s 154 Step: 21.322%, Train loss: 4.174, Val loss: 5.070, time: 0p51s
155
+ 7090.2s 155 Step: 42.644%, Train loss: 4.193, Val loss: 5.096, time: 0p51s
156
+ 7140.7s 156 Step: 63.966%, Train loss: 4.170, Val loss: 5.012, time: 0p50s
157
+ 7190.2s 157 Step: 85.288%, Train loss: 4.152, Val loss: 5.026, time: 0p49s
158
+ 7446.1s 158 Chúng tôi đã bị mất .
159
+ 7446.1s 159 Epoch: 16, Train loss: 4.136, Val loss: 4.964, Bleu: 0.000, Ter: 117.853, CHRF: 5.226, Rough1: 0.032, RoughL: 0.032, Epoch time: 458.699s
160
+ 7496.9s 160 Step: 21.322%, Train loss: 4.042, Val loss: 4.973, time: 0p50s
161
+ 7548.5s 161 Step: 42.644%, Train loss: 4.069, Val loss: 5.065, time: 0p51s
162
+ 7598.9s 162 Step: 63.966%, Train loss: 4.044, Val loss: 4.954, time: 0p50s
163
+ 7648.3s 163 Step: 85.288%, Train loss: 4.026, Val loss: 4.945, time: 0p49s
164
+ 7905.5s 164 Chúng tôi đã bị mất .
165
+ 7905.5s 165 Epoch: 17, Train loss: 4.009, Val loss: 4.881, Bleu: 0.000, Ter: 118.015, CHRF: 5.203, Rough1: 0.033, RoughL: 0.033, Epoch time: 459.469s
166
+ 7956.3s 166 Step: 21.322%, Train loss: 3.907, Val loss: 4.869, time: 0p50s
167
+ 8007.9s 167 Step: 42.644%, Train loss: 3.935, Val loss: 4.983, time: 0p51s
168
+ 8058.2s 168 Step: 63.966%, Train loss: 3.908, Val loss: 4.880, time: 0p50s
169
+ 8107.4s 169 Step: 85.288%, Train loss: 3.890, Val loss: 4.864, time: 0p49s
170
+ 8366.9s 170 Chúng ta đều là người đàn ông .
171
+ 8366.9s 171 Epoch: 18, Train loss: 3.870, Val loss: 4.764, Bleu: 0.000, Ter: 118.659, CHRF: 4.797, Rough1: 0.030, RoughL: 0.030, Epoch time: 461.416s
172
+ 8417.9s 172 Step: 21.322%, Train loss: 3.771, Val loss: 4.794, time: 0p50s
173
+ 8469.7s 173 Step: 42.644%, Train loss: 3.799, Val loss: 4.891, time: 0p51s
174
+ 8520.2s 174 Step: 63.966%, Train loss: 3.766, Val loss: 4.858, time: 0p50s
175
+ 8569.6s 175 Step: 85.288%, Train loss: 3.745, Val loss: 4.794, time: 0p49s
176
+ 8829.3s 176 Chúng ta đều là người đàn ông .
177
+ 8829.3s 177 Epoch: 19, Train loss: 3.724, Val loss: 4.686, Bleu: 0.000, Ter: 118.646, CHRF: 4.726, Rough1: 0.030, RoughL: 0.030, Epoch time: 462.371s
178
+ 8880.0s 178 Step: 21.322%, Train loss: 3.635, Val loss: 4.744, time: 0p50s
179
+ 8931.4s 179 Step: 42.644%, Train loss: 3.660, Val loss: 4.802, time: 0p51s
180
+ 8981.8s 180 Step: 63.966%, Train loss: 3.624, Val loss: 4.743, time: 0p50s
181
+ 9031.3s 181 Step: 85.288%, Train loss: 3.604, Val loss: 4.700, time: 0p49s
182
+ 9292.5s 182 Chúng ta đều là người đàn ông .
183
+ 9292.5s 183 Epoch: 20, Train loss: 3.582, Val loss: 4.607, Bleu: 0.000, Ter: 118.962, CHRF: 4.898, Rough1: 0.031, RoughL: 0.031, Epoch time: 463.159s
184
+ 9343.4s 184 Step: 21.322%, Train loss: 3.507, Val loss: 4.703, time: 0p50s
185
+ 9394.9s 185 Step: 42.644%, Train loss: 3.529, Val loss: 4.722, time: 0p51s
186
+ 9445.2s 186 Step: 63.966%, Train loss: 3.494, Val loss: 4.716, time: 0p50s
187
+ 9494.5s 187 Step: 85.288%, Train loss: 3.475, Val loss: 4.630, time: 0p49s
188
+ 9751.0s 188 Chúng ta đều là người đàn ông .
189
+ 9751.0s 189 Epoch: 21, Train loss: 3.452, Val loss: 4.582, Bleu: 0.000, Ter: 118.642, CHRF: 4.834, Rough1: 0.031, RoughL: 0.031, Epoch time: 458.568s
190
+ 9801.9s 190 Step: 21.322%, Train loss: 3.386, Val loss: 4.632, time: 0p50s
191
+ 9853.5s 191 Step: 42.644%, Train loss: 3.402, Val loss: 4.629, time: 0p51s
192
+ 9903.9s 192 Step: 63.966%, Train loss: 3.365, Val loss: 4.662, time: 0p50s
193
+ 9953.0s 193 Step: 85.288%, Train loss: 3.348, Val loss: 4.538, time: 0p49s
194
+ 10208.3s 194 Chúng ta đều là người Mỹ .
195
+ 10208.3s 195 Epoch: 22, Train loss: 3.324, Val loss: 4.534, Bleu: 0.000, Ter: 118.765, CHRF: 5.051, Rough1: 0.032, RoughL: 0.032, Epoch time: 457.212s
196
+ 10259.0s 196 Step: 21.322%, Train loss: 3.258, Val loss: 4.573, time: 0p50s
197
+ 10310.5s 197 Step: 42.644%, Train loss: 3.274, Val loss: 4.584, time: 0p51s
198
+ 10361.2s 198 Step: 63.966%, Train loss: 3.233, Val loss: 4.634, time: 0p50s
199
+ 10410.5s 199 Step: 85.288%, Train loss: 3.219, Val loss: 4.516, time: 0p49s
200
+ 10659.5s 200 Chúng ta đều là người Mỹ .
201
+ 10659.5s 201 Epoch: 23, Train loss: 3.195, Val loss: 4.528, Bleu: 0.000, Ter: 118.971, CHRF: 4.982, Rough1: 0.032, RoughL: 0.032, Epoch time: 451.261s
202
+ 10710.3s 202 Step: 21.322%, Train loss: 3.130, Val loss: 4.539, time: 0p50s
203
+ 10761.6s 203 Step: 42.644%, Train loss: 3.138, Val loss: 4.533, time: 0p51s
204
+ 10811.9s 204 Step: 63.966%, Train loss: 3.097, Val loss: 4.625, time: 0p50s
205
+ 10861.4s 205 Step: 85.288%, Train loss: 3.085, Val loss: 4.453, time: 0p49s
206
+ 11111.1s 206 Chúng ta đều là người Mỹ .
207
+ 11111.1s 207 Epoch: 24, Train loss: 3.062, Val loss: 4.504, Bleu: 0.000, Ter: 118.565, CHRF: 5.193, Rough1: 0.033, RoughL: 0.033, Epoch time: 451.563s
208
+ 11161.9s 208 Step: 21.322%, Train loss: 2.990, Val loss: 4.590, time: 0p50s
209
+ 11213.2s 209 Step: 42.644%, Train loss: 3.007, Val loss: 4.512, time: 0p51s
210
+ 11263.5s 210 Step: 63.966%, Train loss: 2.971, Val loss: 4.550, time: 0p50s
211
+ 11312.7s 211 Step: 85.288%, Train loss: 2.957, Val loss: 4.402, time: 0p49s
212
+ 11571.9s 212 Chúng ta đều là người Mỹ .
213
+ 11571.9s 213 Epoch: 25, Train loss: 2.933, Val loss: 4.477, Bleu: 0.000, Ter: 119.301, CHRF: 4.786, Rough1: 0.031, RoughL: 0.031, Epoch time: 460.783s
214
+ 11622.7s 214 Step: 21.322%, Train loss: 2.865, Val loss: 4.517, time: 0p50s
215
+ 11674.1s 215 Step: 42.644%, Train loss: 2.879, Val loss: 4.505, time: 0p51s
216
+ 11724.4s 216 Step: 63.966%, Train loss: 2.849, Val loss: 4.436, time: 0p50s
217
+ 11773.7s 217 Step: 85.288%, Train loss: 2.838, Val loss: 4.359, time: 0p49s
218
+ 12032.9s 218 Chúng ta đều là người Anh .
219
+ 12032.9s 219 Epoch: 26, Train loss: 2.815, Val loss: 4.459, Bleu: 0.000, Ter: 118.969, CHRF: 4.947, Rough1: 0.033, RoughL: 0.033, Epoch time: 460.999s
220
+ 12083.8s 220 Step: 21.322%, Train loss: 2.775, Val loss: 4.382, time: 0p50s
221
+ 12135.4s 221 Step: 42.644%, Train loss: 2.771, Val loss: 4.465, time: 0p51s
222
+ 12185.9s 222 Step: 63.966%, Train loss: 2.734, Val loss: 4.435, time: 0p50s
223
+ 12235.1s 223 Step: 85.288%, Train loss: 2.724, Val loss: 4.336, time: 0p49s
224
+ 12485.5s 224 Tất cả đều là bác sĩ ,
225
+ 12485.5s 225 Epoch: 27, Train loss: 2.702, Val loss: 4.423, Bleu: 0.000, Ter: 118.807, CHRF: 5.049, Rough1: 0.034, RoughL: 0.034, Epoch time: 452.668s
226
+ 12536.7s 226 Step: 21.322%, Train loss: 2.666, Val loss: 4.399, time: 0p51s
227
+ 12588.4s 227 Step: 42.644%, Train loss: 2.657, Val loss: 4.356, time: 0p51s
228
+ 12638.8s 228 Step: 63.966%, Train loss: 2.615, Val loss: 4.448, time: 0p50s
229
+ 12688.2s 229 Step: 85.288%, Train loss: 2.605, Val loss: 4.351, time: 0p49s
230
+ 12931.5s 230 Tất cả đều là bác sĩ ,
231
+ 12931.5s 231 Epoch: 28, Train loss: 2.588, Val loss: 4.460, Bleu: 0.000, Ter: 119.036, CHRF: 4.603, Rough1: 0.031, RoughL: 0.031, Epoch time: 445.937s
232
+ 12982.5s 232 Step: 21.322%, Train loss: 2.553, Val loss: 4.396, time: 0p50s
233
+ 13034.0s 233 Step: 42.644%, Train loss: 2.541, Val loss: 4.379, time: 0p51s
234
+ 13084.3s 234 Step: 63.966%, Train loss: 2.495, Val loss: 4.457, time: 0p50s
235
+ 13133.4s 235 Step: 85.288%, Train loss: 2.486, Val loss: 4.371, time: 0p49s
236
+ 13382.4s 236 Tất cả đều là bác sĩ .
237
+ 13382.4s 237 Epoch: 29, Train loss: 2.468, Val loss: 4.488, Bleu: 0.000, Ter: 119.455, CHRF: 4.418, Rough1: 0.030, RoughL: 0.030, Epoch time: 450.957s
238
+ 13433.7s 238 Step: 21.322%, Train loss: 2.426, Val loss: 4.451, time: 0p51s
239
+ 13485.6s 239 Step: 42.644%, Train loss: 2.419, Val loss: 4.389, time: 0p51s
240
+ 13536.4s 240 Step: 63.966%, Train loss: 2.378, Val loss: 4.416, time: 0p50s
241
+ 13586.0s 241 Step: 85.288%, Train loss: 2.371, Val loss: 4.359, time: 0p49s
242
+ 13840.6s 242 Chúng ta đều là bác sĩ .
243
+ 13840.6s 243 Epoch: 30, Train loss: 2.356, Val loss: 4.498, Bleu: 0.000, Ter: 119.159, CHRF: 4.405, Rough1: 0.030, RoughL: 0.030, Epoch time: 458.029s
244
+ 13841.2s 244 Chúng ta đều là bác sĩ .
245
+ 13846.9s 245 /opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py:2930: FutureWarning: --Exporter.preprocessors=["remove_papermill_header.RemovePapermillHeader"] for containers is deprecated in traitlets 5.0. You can pass `--Exporter.preprocessors item` ... multiple times to add items to a list.
246
+ 13846.9s 246 warn(
247
+ 13846.9s 247 [NbConvertApp] WARNING | Config option `kernel_spec_manager_class` not recognized by `NbConvertApp`.
248
+ 13847.0s 248 [NbConvertApp] Converting notebook __notebook__.ipynb to notebook
249
+ 13847.4s 249 [NbConvertApp] Writing 53494 bytes to __notebook__.ipynb
250
+ 13849.0s 250 /opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py:2930: FutureWarning: --Exporter.preprocessors=["nbconvert.preprocessors.ExtractOutputPreprocessor"] for containers is deprecated in traitlets 5.0. You can pass `--Exporter.preprocessors item` ... multiple times to add items to a list.
251
+ 13849.0s 251 warn(
252
+ 13849.0s 252 [NbConvertApp] WARNING | Config option `kernel_spec_manager_class` not recognized by `NbConvertApp`.
253
+ 13849.0s 253 [NbConvertApp] Converting notebook __notebook__.ipynb to html
254
+ 13850.1s 254 [NbConvertApp] Writing 382051 bytes to __results__.html
model/vi_en/Translation_en_vi_transformer/predict.py ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from torchtext.data.utils import get_tokenizer
2
+ from torchtext.vocab import build_vocab_from_iterator
3
+ from torch.utils.data import DataLoader
4
+ from typing import Iterable, List
5
+ import sacrebleu
6
+ from rouge_score import rouge_scorer
7
+ import numpy as np
8
+ import torch
9
+ import html
10
+ from underthesea import word_tokenize
11
+ from torch import Tensor
12
+ import torch
13
+ import torch.nn as nn
14
+ from torch.nn import Transformer
15
+ import math
16
+ from timeit import default_timer as timer
17
+ from torch.nn.utils.rnn import pad_sequence
18
+ from torch.utils.data import Dataset
19
+ import pandas as pd
20
+
21
+ DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
22
+ MAX_LENGTH = 64
23
+ SRC_LANGUAGE = 'en'
24
+ TGT_LANGUAGE = 'vi'
25
+ UNK_IDX, PAD_IDX, BOS_IDX, EOS_IDX = 0, 1, 2, 3
26
+ special_symbols = ['<unk>', '<pad>', '<bos>', '<eos>']
27
+ sentence = {
28
+ 'en': "The patient have a good health",
29
+ 'vi': "Những bệnh nhân này hoàn toàn khỏe mạnh"
30
+ }
31
+
32
+ token_transform = {}
33
+ vocab_transform = {}
34
+
35
+ # Tạo tokenizer cho tiếng việt, anh
36
+ english_tokenizer_func = get_tokenizer('spacy', language='en_core_web_sm')
37
+ def vietnamese_tokenizer(text):
38
+ return word_tokenize(text, format="text").split()[:MAX_LENGTH]
39
+ def english_tokenizer(text):
40
+ return english_tokenizer_func(text)[:MAX_LENGTH]
41
+
42
+ token_transform['en'] = english_tokenizer
43
+ token_transform['vi'] = vietnamese_tokenizer
44
+
45
+ # Tạo vocab
46
+ prefix_vocab = "./model/"
47
+ vocab_transform[SRC_LANGUAGE] = torch.load(prefix_vocab+f'vocab-{SRC_LANGUAGE}.pth')
48
+ vocab_transform[TGT_LANGUAGE] = torch.load(prefix_vocab+f'vocab-{TGT_LANGUAGE}.pth')
49
+
50
+ # Mô hình
51
+ # Mô-đun trợ giúp thêm mã hóa vị trí vào việc nhúng mã thông báo để giới thiệu khái niệm về thứ tự từ.
52
+ class PositionalEncoding(nn.Module):
53
+ def __init__(self,
54
+ emb_size: int,
55
+ dropout: float,
56
+ maxlen: int = 100):
57
+ super(PositionalEncoding, self).__init__()
58
+ den = torch.exp(- torch.arange(0, emb_size, 2)* math.log(10000) / emb_size)
59
+ pos = torch.arange(0, maxlen).reshape(maxlen, 1)
60
+ pos_embedding = torch.zeros((maxlen, emb_size))
61
+ pos_embedding[:, 0::2] = torch.sin(pos * den)
62
+ pos_embedding[:, 1::2] = torch.cos(pos * den)
63
+ pos_embedding = pos_embedding.unsqueeze(-2)
64
+
65
+ self.dropout = nn.Dropout(dropout)
66
+ self.register_buffer('pos_embedding', pos_embedding)
67
+
68
+ def forward(self, token_embedding: Tensor):
69
+ return self.dropout(token_embedding + self.pos_embedding[:token_embedding.size(0), :])
70
+ # Model
71
+ # chuyển token thành vector embedding
72
+ class TokenEmbedding(nn.Module):
73
+ def __init__(self, vocab_size: int, emb_size):
74
+ super(TokenEmbedding, self).__init__()
75
+ self.embedding = nn.Embedding(vocab_size, emb_size)
76
+ self.emb_size = emb_size
77
+
78
+ def forward(self, tokens: Tensor):
79
+ return self.embedding(tokens.long()) * math.sqrt(self.emb_size)
80
+
81
+ # Seq2Seq Network
82
+ class Seq2SeqTransformer(nn.Module):
83
+ def __init__(self,
84
+ num_encoder_layers: int,
85
+ num_decoder_layers: int,
86
+ emb_size: int,
87
+ nhead: int,
88
+ src_vocab_size: int,
89
+ tgt_vocab_size: int,
90
+ dim_feedforward: int = 512,
91
+ dropout: float = 0.1):
92
+ super(Seq2SeqTransformer, self).__init__()
93
+ self.transformer = Transformer(d_model=emb_size,
94
+ nhead=nhead,
95
+ num_encoder_layers=num_encoder_layers,
96
+ num_decoder_layers=num_decoder_layers,
97
+ dim_feedforward=dim_feedforward,
98
+ dropout=dropout)
99
+ self.generator = nn.Linear(emb_size, tgt_vocab_size)
100
+ self.src_tok_emb = TokenEmbedding(src_vocab_size, emb_size)
101
+ self.tgt_tok_emb = TokenEmbedding(tgt_vocab_size, emb_size)
102
+ self.positional_encoding = PositionalEncoding(
103
+ emb_size, dropout=dropout)
104
+
105
+ def forward(self,
106
+ src: Tensor,
107
+ trg: Tensor,
108
+ src_mask: Tensor,
109
+ tgt_mask: Tensor,
110
+ src_padding_mask: Tensor,
111
+ tgt_padding_mask: Tensor,
112
+ memory_key_padding_mask: Tensor):
113
+ src_emb = self.positional_encoding(self.src_tok_emb(src))
114
+ tgt_emb = self.positional_encoding(self.tgt_tok_emb(trg))
115
+ outs = self.transformer(src_emb, tgt_emb, src_mask, tgt_mask, None,
116
+ src_padding_mask, tgt_padding_mask, memory_key_padding_mask)
117
+ return self.generator(outs)
118
+
119
+ def encode(self, src: Tensor, src_mask: Tensor):
120
+ return self.transformer.encoder(self.positional_encoding(
121
+ self.src_tok_emb(src)), src_mask)
122
+
123
+ def decode(self, tgt: Tensor, memory: Tensor, tgt_mask: Tensor):
124
+ return self.transformer.decoder(self.positional_encoding(
125
+ self.tgt_tok_emb(tgt)), memory,
126
+ tgt_mask)
127
+
128
+ # Tạo mặt nạ cho Attention
129
+ def generate_square_subsequent_mask(sz):
130
+ mask = (torch.triu(torch.ones((sz, sz), device=DEVICE)) == 1).transpose(0, 1)
131
+ mask = mask.float().masked_fill(mask == 0, float('-inf')).masked_fill(mask == 1, float(0.0))
132
+ return mask
133
+ # sinh ra output sử dụng greedy
134
+ def greedy_decode(model, src, src_mask, max_len, start_symbol):
135
+ src = src.to(DEVICE)
136
+ src_mask = src_mask.to(DEVICE)
137
+
138
+ memory = model.encode(src, src_mask)
139
+ ys = torch.ones(1, 1).fill_(start_symbol).type(torch.long).to(DEVICE)
140
+ for i in range(max_len-1):
141
+ memory = memory.to(DEVICE)
142
+ tgt_mask = (generate_square_subsequent_mask(ys.size(0))
143
+ .type(torch.bool)).to(DEVICE)
144
+ out = model.decode(ys, memory, tgt_mask)
145
+ out = out.transpose(0, 1)
146
+ prob = model.generator(out[:, -1])
147
+ _, next_word = torch.max(prob, dim=1)
148
+ next_word = next_word.item()
149
+
150
+ ys = torch.cat([ys,
151
+ torch.ones(1, 1).type_as(src.data).fill_(next_word)], dim=0)
152
+ if next_word == EOS_IDX:
153
+ break
154
+ return ys
155
+
156
+ def sequential_transforms(*transforms):
157
+ def func(txt_input):
158
+ for transform in transforms:
159
+ txt_input = transform(txt_input)
160
+ return txt_input
161
+ return func
162
+
163
+ # Thêm các kí tự đầu cuối
164
+ def tensor_transform(token_ids: List[int]):
165
+ return torch.cat((torch.tensor([BOS_IDX]),
166
+ torch.tensor(token_ids),
167
+ torch.tensor([EOS_IDX])))
168
+
169
+ # chuyển string thành các chỉ số
170
+ text_transform = {}
171
+ for ln in [SRC_LANGUAGE, TGT_LANGUAGE]:
172
+ text_transform[ln] = sequential_transforms(token_transform[ln], #Tokenization
173
+ vocab_transform[ln], #Numericalization
174
+ tensor_transform) # Add BOS/EOS and create tensor
175
+ # hàm dịch
176
+ def translate(model: torch.nn.Module, src_sentence: str):
177
+ model.eval()
178
+
179
+ src = text_transform[SRC_LANGUAGE](src_sentence).view(-1, 1)
180
+
181
+ num_tokens = src.shape[0]
182
+ src_mask = (torch.zeros(num_tokens, num_tokens)).type(torch.bool)
183
+ tgt_tokens = greedy_decode(
184
+ model, src, src_mask, max_len=num_tokens + 5, start_symbol=BOS_IDX).flatten()
185
+
186
+ tokens = vocab_transform[TGT_LANGUAGE].lookup_tokens(list(tgt_tokens.cpu().numpy()))
187
+
188
+ predict = []
189
+ for token in tokens:
190
+ subs_token = token.split("_")
191
+ if len(subs_token) > 1:
192
+ predict += subs_token
193
+ else:
194
+ predict.append(token)
195
+
196
+ predict = [item for item in predict if item not in special_symbols]
197
+
198
+ return " ".join(predict).replace("<bos>", "").replace("<eos>", "")
199
+ # Tính toán các metric
200
+ def compute_metrics(decoded_preds, decoded_labels):
201
+ """
202
+ input:
203
+ decoded_preds: ['A','B','C','D']
204
+ decoded_labels: ['a','b','c','d']
205
+ """
206
+ # Tính BLEU
207
+ bleu = sacrebleu.corpus_bleu(decoded_preds, [decoded_labels])
208
+
209
+ # Tính TER
210
+ ter = sacrebleu.corpus_ter(decoded_preds, [decoded_labels])
211
+
212
+ # Tính CHRF
213
+ chrf = sacrebleu.corpus_chrf(decoded_preds, [decoded_labels])
214
+
215
+ # Tính ROUGE
216
+ scorer = rouge_scorer.RougeScorer(['rouge1', 'rougeL'], use_stemmer=True)
217
+ rouge1_scores = []
218
+ rougeL_scores = []
219
+ for pred, label in zip(decoded_preds, decoded_labels):
220
+ scores = scorer.score(pred, label)
221
+ rouge1_scores.append(scores['rouge1'].fmeasure)
222
+ rougeL_scores.append(scores['rougeL'].fmeasure)
223
+
224
+ avg_rouge1 = sum(rouge1_scores) / len(rouge1_scores)
225
+ avg_rougeL = sum(rougeL_scores) / len(rougeL_scores)
226
+
227
+ return {
228
+ "bleu": bleu.score,
229
+ "ter": ter.score,
230
+ "chrf": chrf.score,
231
+ "rouge1": avg_rouge1,
232
+ "rougeL": avg_rougeL
233
+ }
234
+
235
+ #Load data
236
+ def load_file(file_path):
237
+ lang = []
238
+
239
+ with open(file_path, "r", encoding="utf-8") as file:
240
+ content_en = file.read()
241
+ lang += content_en.split('\n')
242
+ lang = [html.unescape(sent) for sent in lang]
243
+ return lang
244
+
245
+ if __name__ == "__main__":
246
+ # load model
247
+ transformer = torch.load(f"./model/model_{SRC_LANGUAGE}_{TGT_LANGUAGE}.pth", map_location = DEVICE)
248
+ print(translate(transformer, sentence[SRC_LANGUAGE]))
249
+
250
+ prefix_translation = "../data/"
251
+
252
+ list_test_en = load_file(prefix_translation+"test/en-2013.en")
253
+ list_test_vi = load_file(prefix_translation+"test/vi-2013.vi")
254
+
255
+ data = {
256
+ 'en':{
257
+ 'test': list_test_en,
258
+ },
259
+ 'vi':{
260
+ 'test': list_test_vi,
261
+ }
262
+ }
263
+
264
+ start_time = timer()
265
+ src = data[SRC_LANGUAGE]['test']
266
+ reference = data[TGT_LANGUAGE]['test']
267
+ candidate = [translate(transformer, sent) for sent in src]
268
+
269
+ translation = pd.DataFrame({
270
+ 'inputs': src,
271
+ 'preds': candidate,
272
+ 'labels': reference
273
+ })
274
+
275
+ metrics = compute_metrics(candidate, reference)
276
+
277
+ result = (f"BLEU: {metrics['bleu']}, TER: {metrics['ter']}, CHRF: {metrics['chrf']}, ROUGE1: {metrics['rouge1']}, ROUGEL: {metrics['rougeL']}")
278
+
279
+ f = open('./result/metrics.txt', 'w')
280
+ f.write(result)
281
+ f.close()
282
+
283
+ translation.to_csv('./result/translation.csv', index=False)
284
+ end_time = timer()
285
+ print(f"Save sucessfull after {end_time-start_time}")
286
+
287
+
model/vi_en/Translation_en_vi_transformer/result/metrics.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ BLEU: 11.861815829790698, TER: 72.4630366367793, CHRF: 29.322997294803642, ROUGE1: 0.5952671476070954, ROUGEL: 0.47220229602754843
model/vi_en/Translation_en_vi_transformer/result/translation.csv ADDED
The diff for this file is too large to render. See raw diff
 
model/vi_en/Translation_en_vi_transformer/train.py ADDED
@@ -0,0 +1,427 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from torchtext.data.utils import get_tokenizer
2
+ from torchtext.vocab import build_vocab_from_iterator
3
+ from torch.utils.data import DataLoader
4
+ from typing import Iterable, List
5
+ import sacrebleu
6
+ from rouge_score import rouge_scorer
7
+ import numpy as np
8
+ import torch
9
+ import html
10
+ from underthesea import word_tokenize
11
+ from torch import Tensor
12
+ import torch
13
+ import torch.nn as nn
14
+ from torch.nn import Transformer
15
+ import math
16
+ from timeit import default_timer as timer
17
+ from torch.nn.utils.rnn import pad_sequence
18
+ from torch.utils.data import Dataset
19
+
20
+ DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
21
+ MAX_LENGTH = 64
22
+ SRC_LANGUAGE = 'en'
23
+ TGT_LANGUAGE = 'vi'
24
+ #config các tham số và siêu tham số mô hình
25
+ EMB_SIZE = 512
26
+ NHEAD = 8
27
+ FFN_HID_DIM = 2048
28
+ BATCH_SIZE = 64 # 32 -> 128
29
+ NUM_ENCODER_LAYERS = 6
30
+ NUM_DECODER_LAYERS = 6
31
+ sentence = {
32
+ 'en': 'we all are doctors',
33
+ 'vi': "Chúng tôi là những bác sĩ"
34
+ }
35
+
36
+ #Load data
37
+ def load_file(file_path):
38
+ lang = []
39
+
40
+ with open(file_path, "r", encoding="utf-8") as file:
41
+ content_en = file.read()
42
+ lang += content_en.split('\n')
43
+ lang = [html.unescape(sent) for sent in lang]
44
+ return lang
45
+ prefix_translation = "../data/"
46
+
47
+ list_train_en = load_file(prefix_translation+"train/en.en")
48
+ list_train_vi = load_file(prefix_translation+"train/vi.vi")
49
+
50
+ list_test_en = load_file(prefix_translation+"test/en-2013.en")
51
+ list_test_vi = load_file(prefix_translation+"test/vi-2013.vi")
52
+
53
+ list_dev_en = load_file(prefix_translation+"dev/en-2012.en")
54
+ list_dev_vi = load_file(prefix_translation+"dev/vi-2012.vi")
55
+
56
+ data = {
57
+ 'en':{
58
+ 'train': list_train_en,
59
+ 'test': list_test_en,
60
+ 'dev': list_dev_en
61
+ },
62
+ 'vi':{
63
+ 'train': list_train_vi,
64
+ 'test': list_test_vi,
65
+ 'dev': list_dev_vi
66
+ }
67
+ }
68
+
69
+ # Place-holders
70
+ token_transform = {}
71
+ vocab_transform = {}
72
+
73
+
74
+ # Tạo tokenizer cho tiếng việt, anh
75
+ english_tokenizer_func = get_tokenizer('spacy', language='en_core_web_sm')
76
+ def vietnamese_tokenizer(text):
77
+ return word_tokenize(text, format="text").split()[:MAX_LENGTH]
78
+ def english_tokenizer(text):
79
+ return english_tokenizer_func(text)[:MAX_LENGTH]
80
+
81
+ token_transform['en'] = english_tokenizer
82
+ token_transform['vi'] = vietnamese_tokenizer
83
+
84
+ # Xây vocab và lưu lại
85
+ def yield_tokens(data_iter: Iterable, language: str) -> List[str]:
86
+
87
+ for data_sample in data_iter[language]['train']:
88
+ yield token_transform[language](data_sample)
89
+
90
+ # định nghĩa các kí tự đặc biệt
91
+ UNK_IDX, PAD_IDX, BOS_IDX, EOS_IDX = 0, 1, 2, 3
92
+
93
+ special_symbols = ['<unk>', '<pad>', '<bos>', '<eos>']
94
+
95
+ for ln in [SRC_LANGUAGE, TGT_LANGUAGE]:
96
+ # tạo vocab cho từng ngôn ngữ
97
+ vocab_transform[ln] = build_vocab_from_iterator(yield_tokens(data, ln),
98
+ min_freq=1,
99
+ specials=special_symbols,
100
+ special_first=True)
101
+ for ln in [SRC_LANGUAGE, TGT_LANGUAGE]:
102
+ vocab_transform[ln].set_default_index(UNK_IDX)
103
+
104
+ torch.save(vocab_transform[SRC_LANGUAGE], f"vocab-{SRC_LANGUAGE}")
105
+ torch.save(vocab_transform[TGT_LANGUAGE], f"vocab-{TGT_LANGUAGE}")
106
+ SRC_VOCAB_SIZE = len(vocab_transform[SRC_LANGUAGE])
107
+ TGT_VOCAB_SIZE = len(vocab_transform[TGT_LANGUAGE])
108
+
109
+ # Mô hình
110
+ # Mô-đun trợ giúp thêm mã hóa vị trí vào việc nhúng mã thông báo để giới thiệu khái niệm về thứ tự từ.
111
+ class PositionalEncoding(nn.Module):
112
+ def __init__(self,
113
+ emb_size: int,
114
+ dropout: float,
115
+ maxlen: int = 100):
116
+ super(PositionalEncoding, self).__init__()
117
+ den = torch.exp(- torch.arange(0, emb_size, 2)* math.log(10000) / emb_size)
118
+ pos = torch.arange(0, maxlen).reshape(maxlen, 1)
119
+ pos_embedding = torch.zeros((maxlen, emb_size))
120
+ pos_embedding[:, 0::2] = torch.sin(pos * den)
121
+ pos_embedding[:, 1::2] = torch.cos(pos * den)
122
+ pos_embedding = pos_embedding.unsqueeze(-2)
123
+
124
+ self.dropout = nn.Dropout(dropout)
125
+ self.register_buffer('pos_embedding', pos_embedding)
126
+
127
+ def forward(self, token_embedding: Tensor):
128
+ return self.dropout(token_embedding + self.pos_embedding[:token_embedding.size(0), :])
129
+
130
+ # chuyển token thành vector embedding
131
+ class TokenEmbedding(nn.Module):
132
+ def __init__(self, vocab_size: int, emb_size):
133
+ super(TokenEmbedding, self).__init__()
134
+ self.embedding = nn.Embedding(vocab_size, emb_size)
135
+ self.emb_size = emb_size
136
+
137
+ def forward(self, tokens: Tensor):
138
+ return self.embedding(tokens.long()) * math.sqrt(self.emb_size)
139
+
140
+ # Seq2Seq Network
141
+ class Seq2SeqTransformer(nn.Module):
142
+ def __init__(self,
143
+ num_encoder_layers: int,
144
+ num_decoder_layers: int,
145
+ emb_size: int,
146
+ nhead: int,
147
+ src_vocab_size: int,
148
+ tgt_vocab_size: int,
149
+ dim_feedforward: int = 512,
150
+ dropout: float = 0.1):
151
+ super(Seq2SeqTransformer, self).__init__()
152
+ self.transformer = Transformer(d_model=emb_size,
153
+ nhead=nhead,
154
+ num_encoder_layers=num_encoder_layers,
155
+ num_decoder_layers=num_decoder_layers,
156
+ dim_feedforward=dim_feedforward,
157
+ dropout=dropout)
158
+ self.generator = nn.Linear(emb_size, tgt_vocab_size)
159
+ self.src_tok_emb = TokenEmbedding(src_vocab_size, emb_size)
160
+ self.tgt_tok_emb = TokenEmbedding(tgt_vocab_size, emb_size)
161
+ self.positional_encoding = PositionalEncoding(
162
+ emb_size, dropout=dropout)
163
+
164
+ def forward(self,
165
+ src: Tensor,
166
+ trg: Tensor,
167
+ src_mask: Tensor,
168
+ tgt_mask: Tensor,
169
+ src_padding_mask: Tensor,
170
+ tgt_padding_mask: Tensor,
171
+ memory_key_padding_mask: Tensor):
172
+ src_emb = self.positional_encoding(self.src_tok_emb(src))
173
+ tgt_emb = self.positional_encoding(self.tgt_tok_emb(trg))
174
+ outs = self.transformer(src_emb, tgt_emb, src_mask, tgt_mask, None,
175
+ src_padding_mask, tgt_padding_mask, memory_key_padding_mask)
176
+ return self.generator(outs)
177
+
178
+ def encode(self, src: Tensor, src_mask: Tensor):
179
+ return self.transformer.encoder(self.positional_encoding(
180
+ self.src_tok_emb(src)), src_mask)
181
+
182
+ def decode(self, tgt: Tensor, memory: Tensor, tgt_mask: Tensor):
183
+ return self.transformer.decoder(self.positional_encoding(
184
+ self.tgt_tok_emb(tgt)), memory,
185
+ tgt_mask)
186
+
187
+ # Tạo mặt nạ cho Attention
188
+ def generate_square_subsequent_mask(sz):
189
+ mask = (torch.triu(torch.ones((sz, sz), device=DEVICE)) == 1).transpose(0, 1)
190
+ mask = mask.float().masked_fill(mask == 0, float('-inf')).masked_fill(mask == 1, float(0.0))
191
+ return mask
192
+
193
+
194
+ def create_mask(src, tgt):
195
+ src_seq_len = src.shape[0]
196
+ tgt_seq_len = tgt.shape[0]
197
+
198
+ tgt_mask = generate_square_subsequent_mask(tgt_seq_len)
199
+ src_mask = torch.zeros((src_seq_len, src_seq_len),device=DEVICE).type(torch.bool)
200
+
201
+ src_padding_mask = (src == PAD_IDX).transpose(0, 1)
202
+ tgt_padding_mask = (tgt == PAD_IDX).transpose(0, 1)
203
+ return src_mask, tgt_mask, src_padding_mask, tgt_padding_mask
204
+
205
+ # build model
206
+ torch.manual_seed(0)
207
+
208
+ transformer = Seq2SeqTransformer(NUM_ENCODER_LAYERS, NUM_DECODER_LAYERS, EMB_SIZE,
209
+ NHEAD, SRC_VOCAB_SIZE, TGT_VOCAB_SIZE, FFN_HID_DIM)
210
+
211
+ for p in transformer.parameters():
212
+ if p.dim() > 1:
213
+ nn.init.xavier_uniform_(p)
214
+
215
+ transformer = transformer.to(DEVICE)
216
+
217
+ loss_fn = torch.nn.CrossEntropyLoss(ignore_index=PAD_IDX)
218
+
219
+ optimizer = torch.optim.Adam(transformer.parameters(), lr=0.0001, betas=(0.9, 0.98), eps=1e-9)
220
+
221
+ #Chuẩn bị dữ liệu
222
+
223
+ def sequential_transforms(*transforms):
224
+ def func(txt_input):
225
+ for transform in transforms:
226
+ txt_input = transform(txt_input)
227
+ return txt_input
228
+ return func
229
+
230
+ # Thêm các kí tự đầu cuối
231
+ def tensor_transform(token_ids: List[int]):
232
+ return torch.cat((torch.tensor([BOS_IDX]),
233
+ torch.tensor(token_ids),
234
+ torch.tensor([EOS_IDX])))
235
+
236
+ # chuyển string thành các chỉ số
237
+ text_transform = {}
238
+ for ln in [SRC_LANGUAGE, TGT_LANGUAGE]:
239
+ text_transform[ln] = sequential_transforms(token_transform[ln], #Tokenization
240
+ vocab_transform[ln], #Numericalization
241
+ tensor_transform) # Add BOS/EOS and create tensor
242
+
243
+
244
+ # chuyển các mẫu dữ liệu vào dataloader
245
+ def collate_fn(batch):
246
+ src_batch, tgt_batch = [], []
247
+ for src_sample, tgt_sample in batch:
248
+ src_batch.append(text_transform[SRC_LANGUAGE](src_sample.rstrip("\n")))
249
+ tgt_batch.append(text_transform[TGT_LANGUAGE](tgt_sample.rstrip("\n")))
250
+
251
+ src_batch = pad_sequence(src_batch, padding_value=PAD_IDX)
252
+ tgt_batch = pad_sequence(tgt_batch, padding_value=PAD_IDX)
253
+ return src_batch, tgt_batch
254
+
255
+ # Tạo dataset
256
+
257
+ class MyDataset(Dataset):
258
+ def __init__(self, src, trg):
259
+ self.src = src
260
+ self.trg = trg
261
+ def __len__(self):
262
+ return len(self.src)
263
+
264
+ def __getitem__(self, index):
265
+ return self.src[index], self.trg[index]
266
+ train_dataset = MyDataset(data[SRC_LANGUAGE]['train'], data[TGT_LANGUAGE]['train'])
267
+ test_dataset = MyDataset(data[SRC_LANGUAGE]['test'], data[TGT_LANGUAGE]['test'])
268
+
269
+ # sinh ra output sử dụng greedy
270
+ def greedy_decode(model, src, src_mask, max_len, start_symbol):
271
+ src = src.to(DEVICE)
272
+ src_mask = src_mask.to(DEVICE)
273
+
274
+ memory = model.encode(src, src_mask)
275
+ ys = torch.ones(1, 1).fill_(start_symbol).type(torch.long).to(DEVICE)
276
+ for i in range(max_len-1):
277
+ memory = memory.to(DEVICE)
278
+ tgt_mask = (generate_square_subsequent_mask(ys.size(0))
279
+ .type(torch.bool)).to(DEVICE)
280
+ out = model.decode(ys, memory, tgt_mask)
281
+ out = out.transpose(0, 1)
282
+ prob = model.generator(out[:, -1])
283
+ _, next_word = torch.max(prob, dim=1)
284
+ next_word = next_word.item()
285
+
286
+ ys = torch.cat([ys,
287
+ torch.ones(1, 1).type_as(src.data).fill_(next_word)], dim=0)
288
+ if next_word == EOS_IDX:
289
+ break
290
+ return ys
291
+
292
+
293
+ # hàm dịch
294
+ def translate(model: torch.nn.Module, src_sentence: str):
295
+ model.eval()
296
+
297
+ src = text_transform[SRC_LANGUAGE](src_sentence).view(-1, 1)
298
+
299
+ num_tokens = src.shape[0]
300
+ src_mask = (torch.zeros(num_tokens, num_tokens)).type(torch.bool)
301
+ tgt_tokens = greedy_decode(
302
+ model, src, src_mask, max_len=num_tokens + 5, start_symbol=BOS_IDX).flatten()
303
+
304
+ tokens = vocab_transform[TGT_LANGUAGE].lookup_tokens(list(tgt_tokens.cpu().numpy()))
305
+
306
+ predict = []
307
+ for token in tokens:
308
+ subs_token = token.split("_")
309
+ if len(subs_token) > 1:
310
+ predict += subs_token
311
+ else:
312
+ predict.append(token)
313
+
314
+ predict = [item for item in predict if item not in special_symbols]
315
+
316
+ return " ".join(predict).replace("<bos>", "").replace("<eos>", "")
317
+
318
+ def unsqueeze(lst: list, dim = -1):
319
+ lst = np.expand_dims(lst, axis=dim)
320
+ return lst.tolist()
321
+
322
+ def convert_ids_to_sentences(ids: torch.Tensor, language):
323
+ """
324
+ input:
325
+ [[ 2, 2, 2, ..., 2, 2, 2],
326
+ [ 6693, 133, 12, ..., 48, 133, 796],
327
+ [17755, 2869, 177, ..., 23, 861, 6],
328
+ ...,
329
+ [ 1, 1, 1, ..., 1, 1, 1],
330
+ [ 1, 1, 1, ..., 1, 1, 1],
331
+ [ 1, 1, 1, ..., 1, 1, 1]]
332
+ """
333
+ sentences = []
334
+ for ids_token in ids.transpose(0,1).tolist():
335
+ sent = []
336
+ for token in vocab_transform[language].lookup_tokens(ids_token):
337
+ subs_token = token.split("_")
338
+ if len(subs_token) > 1:
339
+ sent += subs_token
340
+ else:
341
+ sent.append(token)
342
+
343
+ sent = [item for item in sent if item not in special_symbols]
344
+
345
+ sentences.append(" ".join(sent).replace("<bos>", "").replace("<eos>", "").replace("<pad>",""))
346
+
347
+ return sentences
348
+
349
+ #tạo train và đánh giá cho từng epoch
350
+ def epoch_time(start_time, end_time):
351
+ elapsed_time = end_time - start_time
352
+ elapsed_mins = int(elapsed_time / 60)
353
+ elapsed_secs = int(elapsed_time - (elapsed_mins * 60))
354
+ return f"{elapsed_mins}p{elapsed_secs}s"
355
+
356
+ def evaluate(model):
357
+ model.eval()
358
+ losses = 0
359
+
360
+ val_dataloader = DataLoader(test_dataset, batch_size=BATCH_SIZE, collate_fn=collate_fn)
361
+
362
+ for src, tgt in val_dataloader:
363
+ src = src.to(DEVICE)
364
+ tgt = tgt.to(DEVICE)
365
+
366
+ tgt_input = tgt[:-1, :]
367
+
368
+ src_mask, tgt_mask, src_padding_mask, tgt_padding_mask = create_mask(src, tgt_input)
369
+
370
+ logits = model(src, tgt_input, src_mask, tgt_mask,src_padding_mask, tgt_padding_mask, src_padding_mask)
371
+
372
+ tgt_out = tgt[1:, :]
373
+ loss = loss_fn(logits.reshape(-1, logits.shape[-1]), tgt_out.reshape(-1))
374
+ losses += loss.item()
375
+
376
+ return losses / len(list(val_dataloader))
377
+
378
+ def train_epoch(model, optimizer, log_step = 100):
379
+ losses = []
380
+ train_dataloader = DataLoader(train_dataset, batch_size=BATCH_SIZE, collate_fn=collate_fn)
381
+ total = len(train_dataloader)
382
+ step = 0
383
+
384
+ current_time = timer()
385
+ for src, tgt in train_dataloader:
386
+ model.train()
387
+ src = src.to(DEVICE)
388
+ tgt = tgt.to(DEVICE)
389
+
390
+ tgt_input = tgt[:-1, :]
391
+
392
+ src_mask, tgt_mask, src_padding_mask, tgt_padding_mask = create_mask(src, tgt_input)
393
+
394
+ logits = model(src, tgt_input, src_mask, tgt_mask,src_padding_mask, tgt_padding_mask, src_padding_mask)
395
+
396
+ optimizer.zero_grad()
397
+
398
+ tgt_out = tgt[1:, :]
399
+ loss = loss_fn(logits.reshape(-1, logits.shape[-1]), tgt_out.reshape(-1))
400
+ loss.backward()
401
+
402
+ optimizer.step()
403
+ losses.append(loss.item())
404
+ step += 1
405
+ if step % log_step == 0:
406
+ val_loss = evaluate(model)
407
+ end_time = timer()
408
+
409
+ print(f"Step: {(step*100 / total):.3f}%, Train loss: {np.mean(losses):.3f}, Val loss: {val_loss:.3f}, time: {epoch_time(current_time, end_time)}")
410
+ current_time = timer()
411
+
412
+ return np.mean(losses)
413
+
414
+ #bắt đầu train
415
+ NUM_EPOCHS = 30 # 1 -> 18
416
+
417
+ for epoch in range(1, NUM_EPOCHS+1):
418
+ start_time = timer()
419
+ train_loss = train_epoch(transformer, optimizer) # mở lại
420
+ val_loss = evaluate(transformer)
421
+ print(translate(transformer, sentence[SRC_LANGUAGE]))
422
+ end_time = timer()
423
+ result = (f"Epoch: {epoch}, Train loss: {train_loss:.3f}, Val loss: {val_loss:.3f}, Epoch time: {(end_time - start_time):.3f}s")
424
+ print(result)
425
+
426
+ #Lưu mô hình
427
+ torch.save(transformer, f'model-{SRC_LANGUAGE}-{TGT_LANGUAGE}.pth')
model/vi_en/Translation_vi_en_baseline/final-result/metric.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ bleu ter chrf rouge1 rougeL
2
+ 9.771361050393118 85.18033522897336 26.09930283387139 0.36767792667830157 0.34445502776591713
model/vi_en/Translation_vi_en_baseline/final-result/translation.csv ADDED
The diff for this file is too large to render. See raw diff
 
model/vi_en/Translation_vi_en_baseline/log/model-vi-en-baseline.log ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 9.6s 1 Collecting sacrebleu
2
+ 9.7s 2 Downloading sacrebleu-2.4.2-py3-none-any.whl.metadata (58 kB)
3
+ 9.8s 3 [?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/58.0 kB ? eta -:--:--
4
+ 9.9s 4 [?25hCollecting portalocker (from sacrebleu)
5
+ 9.9s 5 Downloading portalocker-2.10.1-py3-none-any.whl.metadata (8.5 kB)
6
+ 9.9s 6 Requirement already satisfied: regex in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (2023.12.25)
7
+ 9.9s 7 Requirement already satisfied: tabulate>=0.8.9 in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (0.9.0)
8
+ 9.9s 8 Requirement already satisfied: numpy>=1.17 in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (1.26.4)
9
+ 9.9s 9 Requirement already satisfied: colorama in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (0.4.6)
10
+ 9.9s 10 Requirement already satisfied: lxml in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (5.2.2)
11
+ 10.0s 11 Downloading sacrebleu-2.4.2-py3-none-any.whl (106 kB)
12
+ 10.0s 12 [?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/106.7 kB ? eta -:--:--
13
+ 10.1s 13 [?25hDownloading portalocker-2.10.1-py3-none-any.whl (18 kB)
14
+ 20.9s 14 Installing collected packages: portalocker, sacrebleu
15
+ 21.2s 15 Successfully installed portalocker-2.10.1 sacrebleu-2.4.2
16
+ 22.4s 16 Collecting rouge-score
17
+ 22.5s 17 Downloading rouge_score-0.1.2.tar.gz (17 kB)
18
+ 23.6s 18 Preparing metadata (setup.py) ... [?25l- done
19
+ 23.6s 19 [?25hRequirement already satisfied: absl-py in /opt/conda/lib/python3.10/site-packages (from rouge-score) (1.4.0)
20
+ 23.6s 20 Requirement already satisfied: nltk in /opt/conda/lib/python3.10/site-packages (from rouge-score) (3.2.4)
21
+ 23.6s 21 Requirement already satisfied: numpy in /opt/conda/lib/python3.10/site-packages (from rouge-score) (1.26.4)
22
+ 23.6s 22 Requirement already satisfied: six>=1.14.0 in /opt/conda/lib/python3.10/site-packages (from rouge-score) (1.16.0)
23
+ 23.6s 23 Building wheels for collected packages: rouge-score
24
+ 25.0s 24 Building wheel for rouge-score (setup.py) ... [?25l- \ done
25
+ 25.0s 25 [?25h Created wheel for rouge-score: filename=rouge_score-0.1.2-py3-none-any.whl size=24934 sha256=3d71c128b31f3c60de3876d6dacad5990c89e8b8d38327d566d012100f87e497
26
+ 25.0s 26 Stored in directory: /root/.cache/pip/wheels/5f/dd/89/461065a73be61a532ff8599a28e9beef17985c9e9c31e541b4
27
+ 25.0s 27 Successfully built rouge-score
28
+ 35.0s 28 Installing collected packages: rouge-score
29
+ 35.2s 29 Successfully installed rouge-score-0.1.2
30
+ 35.5s 30 Note: you may need to restart the kernel to use updated packages.
31
+ 44.1s 31 2024-08-06 03:37:45.556306: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
32
+ 44.1s 32 2024-08-06 03:37:45.556419: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
33
+ 44.1s 33 2024-08-06 03:37:45.736174: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
34
+ 44.3s 34 2024-08-06 03:37:45.556306: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
35
+ 44.3s 35 2024-08-06 03:37:45.556419: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
36
+ 44.3s 36 2024-08-06 03:37:45.736174: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
37
+ 62.6s 37 /opt/conda/lib/python3.10/site-packages/transformers/tokenization_utils_base.py:4016: UserWarning: `as_target_tokenizer` is deprecated and will be removed in v5 of Transformers. You can tokenize your labels by using the argument `text_target` of the regular `__call__` method (either in the same call as your input texts if you use the same keyword arguments, or in a separate call.
38
+ 62.6s 38 warnings.warn(
39
+ 88.7s 39 wandb: W&B API key is configured. Use `wandb login --relogin` to force relogin
40
+ 88.7s 40 wandb: WARNING If you're specifying your api key in code, ensure this code is not shared publicly.
41
+ 88.7s 41 wandb: WARNING Consider setting the WANDB_API_KEY environment variable, or running `wandb login` from the command line.
42
+ 88.7s 42 wandb: Appending key for api.wandb.ai to your netrc file: /root/.netrc
43
+ 88.9s 43 /opt/conda/lib/python3.10/site-packages/transformers/training_args.py:1494: FutureWarning: `evaluation_strategy` is deprecated and will be removed in version 4.46 of 🤗 Transformers. Use `eval_strategy` instead
44
+ 88.9s 44 warnings.warn(
45
+ 90.2s 45 wandb: WARNING The `run_name` is currently set to the same value as `TrainingArguments.output_dir`. If this was not intended, please specify a different run name by setting the `TrainingArguments.run_name` parameter.
46
+ 90.2s 46 wandb: Currently logged in as: lananhmtms1 (lananhmtms1-mtms1). Use `wandb login --relogin` to force relogin
47
+ 105.5s 47 wandb: wandb version 0.17.5 is available! To upgrade, please run:
48
+ 105.5s 48 wandb: $ pip install wandb --upgrade
49
+ 105.5s 49 wandb: Tracking run with wandb version 0.17.4
50
+ 105.5s 50 wandb: Run data is saved locally in /kaggle/working/wandb/run-20240806_033832-mrv1507q
51
+ 105.5s 51 wandb: Run `wandb offline` to turn off syncing.
52
+ 105.5s 52 wandb: Syncing run ./results-vi-en-base
53
+ 105.5s 53 wandb: ⭐️ View project at https://wandb.ai/lananhmtms1-mtms1/huggingface
54
+ 105.5s 54 wandb: 🚀 View run at https://wandb.ai/lananhmtms1-mtms1/huggingface/runs/mrv1507q
55
+ 108.4s 55 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
56
+ 108.4s 56 warnings.warn('Was asked to gather along dimension 0, but all '
57
+ 294.2s 57 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
58
+ 294.2s 58 warnings.warn('Was asked to gather along dimension 0, but all '
59
+ 452.7s 59 Translated: And I think that if I'm a apologist, I'm going to be a pragmatologist.
60
+ 485.2s 60 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
61
+ 485.2s 61 warnings.warn('Was asked to gather along dimension 0, but all '
62
+ 675.7s 62 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
63
+ 675.7s 63 warnings.warn('Was asked to gather along dimension 0, but all '
64
+ 834.9s 64 Translated: I mean, if you're going to be able to do that, you're going to be able to do that.
65
+ 868.9s 65 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
66
+ 868.9s 66 warnings.warn('Was asked to gather along dimension 0, but all '
67
+ 1062.6s 67 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
68
+ 1062.6s 68 warnings.warn('Was asked to gather along dimension 0, but all '
69
+ 1223.5s 69 Translated: And I'm not going to be a sexy, but I'm going to say, that's a sexy, a sexy, a
70
+ 1257.7s 70 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
71
+ 1257.7s 71 warnings.warn('Was asked to gather along dimension 0, but all '
72
+ 1452.4s 72 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
73
+ 1452.4s 73 warnings.warn('Was asked to gather along dimension 0, but all '
74
+ 1612.1s 74 Translated: We have a lot of people who are able to do it and we can do it.
75
+ 1647.4s 75 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
76
+ 1647.4s 76 warnings.warn('Was asked to gather along dimension 0, but all '
77
+ 1843.2s 77 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
78
+ 1843.2s 78 warnings.warn('Was asked to gather along dimension 0, but all '
79
+ 2003.5s 79 Translated: We're talking about the sex and the sex and the sex, and we're going to talk about the sex and the sex.
80
+ 2037.8s 80 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
81
+ 2037.8s 81 warnings.warn('Was asked to gather along dimension 0, but all '
82
+ 2233.2s 82 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
83
+ 2233.2s 83 warnings.warn('Was asked to gather along dimension 0, but all '
84
+ 2394.4s 84 Translated: I'm a sluggish and slamish, and I'm a sluggish slam.
85
+ 2429.1s 85 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
86
+ 2429.1s 86 warnings.warn('Was asked to gather along dimension 0, but all '
87
+ 2626.0s 87 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
88
+ 2626.0s 88 warnings.warn('Was asked to gather along dimension 0, but all '
89
+ 2787.2s 89 Translated: We are a little bit of a symphony and a symphony, which is a very good way to get the symphony to be able to do that
90
+ 2823.7s 90 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
91
+ 2823.7s 91 warnings.warn('Was asked to gather along dimension 0, but all '
92
+ 3021.2s 92 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
93
+ 3021.2s 93 warnings.warn('Was asked to gather along dimension 0, but all '
94
+ 3183.3s 94 Translated: We are the ones that are going to be able to do this and do it, it's a way to make the world more accessible.
95
+ 3218.9s 95 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
96
+ 3218.9s 96 warnings.warn('Was asked to gather along dimension 0, but all '
97
+ 3416.2s 97 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
98
+ 3416.2s 98 warnings.warn('Was asked to gather along dimension 0, but all '
99
+ 3578.6s 99 Translated: We're the symphony and the symboly and the symboly, that's how it's a symphony.
100
+ 3614.9s 100 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
101
+ 3614.9s 101 warnings.warn('Was asked to gather along dimension 0, but all '
102
+ 3812.5s 102 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
103
+ 3812.5s 103 warnings.warn('Was asked to gather along dimension 0, but all '
104
+ 3974.5s 104 Translated: I mean, the sex is a bit more, and it's more of a sex, and it's more of a sex than the sex.
105
+ 4011.7s 105 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
106
+ 4011.7s 106 warnings.warn('Was asked to gather along dimension 0, but all '
107
+ 4209.2s 107 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
108
+ 4209.2s 108 warnings.warn('Was asked to gather along dimension 0, but all '
109
+ 4371.8s 109 Translated: We're the people who are able to eat and eat and eat and drink and they're going to be able to eat.
110
+ 4407.4s 110 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
111
+ 4407.4s 111 warnings.warn('Was asked to gather along dimension 0, but all '
112
+ 4605.9s 112 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
113
+ 4605.9s 113 warnings.warn('Was asked to gather along dimension 0, but all '
114
+ 4767.7s 114 Translated: We are the people who are able to do this and tell them that they're going to be able to do this.
115
+ 4804.1s 115 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
116
+ 4804.1s 116 warnings.warn('Was asked to gather along dimension 0, but all '
117
+ 5002.3s 117 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
118
+ 5002.3s 118 warnings.warn('Was asked to gather along dimension 0, but all '
119
+ 5163.9s 119 Translated: We're a bit more awaited and a little bit more awaited, but we're a little more awaited, and we're a little more awaited,
120
+ 5200.8s 120 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
121
+ 5200.8s 121 warnings.warn('Was asked to gather along dimension 0, but all '
122
+ 5400.4s 122 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
123
+ 5400.4s 123 warnings.warn('Was asked to gather along dimension 0, but all '
124
+ 5562.2s 124 Translated: We are the syroscopic and he's showing you, it's a very simple way to make a difference.
125
+ 5599.0s 125 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
126
+ 5599.0s 126 warnings.warn('Was asked to gather along dimension 0, but all '
127
+ 5796.8s 127 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
128
+ 5796.8s 128 warnings.warn('Was asked to gather along dimension 0, but all '
129
+ 5958.6s 129 Translated: We are a lot of sexy and sexy, but it's not a lot of sexy.
130
+ 5994.7s 130 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
131
+ 5994.7s 131 warnings.warn('Was asked to gather along dimension 0, but all '
132
+ 6191.8s 132 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
133
+ 6191.8s 133 warnings.warn('Was asked to gather along dimension 0, but all '
134
+ 6353.9s 134 Translated: We are the ones that are a bit more than a little bit more and a little bit more than a little bit more.
135
+ 6390.5s 135 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
136
+ 6390.5s 136 warnings.warn('Was asked to gather along dimension 0, but all '
137
+ 6590.2s 137 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
138
+ 6590.2s 138 warnings.warn('Was asked to gather along dimension 0, but all '
139
+ 6753.5s 139 Translated: We are a team of sex and sex, and we're going to have to make sure that the sex is a sex.
140
+ 6789.2s 140 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
141
+ 6789.2s 141 warnings.warn('Was asked to gather along dimension 0, but all '
142
+ 6988.2s 142 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
143
+ 6988.2s 143 warnings.warn('Was asked to gather along dimension 0, but all '
144
+ 7150.8s 144 Translated: We're a lot of sex, and he's a little bit sucked away, so that's not a lot of sex.
145
+ 7186.4s 145 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
146
+ 7186.4s 146 warnings.warn('Was asked to gather along dimension 0, but all '
147
+ 7385.9s 147 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
148
+ 7385.9s 148 warnings.warn('Was asked to gather along dimension 0, but all '
149
+ 7549.1s 149 Translated: We are a kind of a sexy, and we're a little more sexy, and we're a little more sexy.
150
+ 7585.0s 150 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
151
+ 7585.0s 151 warnings.warn('Was asked to gather along dimension 0, but all '
152
+ 7782.6s 152 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
153
+ 7782.6s 153 warnings.warn('Was asked to gather along dimension 0, but all '
154
+ 7944.9s 154 Translated: We're all a little bit, and we're all a little bit, but it's a little bit a little bit sluggish, and it's a
155
+ 7981.1s 155 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
156
+ 7981.1s 156 warnings.warn('Was asked to gather along dimension 0, but all '
157
+ 8181.5s 157 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
158
+ 8181.5s 158 warnings.warn('Was asked to gather along dimension 0, but all '
159
+ 8344.3s 159 Translated: We're all of the sexy and sexy, and you're going to be able to make the sexy, sexy, and that's why we
160
+ 8380.4s 160 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
161
+ 8380.4s 161 warnings.warn('Was asked to gather along dimension 0, but all '
162
+ 8580.7s 162 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
163
+ 8580.7s 163 warnings.warn('Was asked to gather along dimension 0, but all '
164
+ 8744.6s 164 Translated: We were the only people who were interested in and who were interested in that, that they were not afraid to be a part of the society.
165
+ 8780.1s 165 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
166
+ 8780.1s 166 warnings.warn('Was asked to gather along dimension 0, but all '
167
+ 8978.9s 167 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
168
+ 8978.9s 168 warnings.warn('Was asked to gather along dimension 0, but all '
169
+ 9142.8s 169 Translated: We're all the sandboxes and he's, and that's why we're going to be able to make the world a better place.
170
+ 9179.6s 170 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
171
+ 9179.6s 171 warnings.warn('Was asked to gather along dimension 0, but all '
172
+ 9378.1s 172 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
173
+ 9378.1s 173 warnings.warn('Was asked to gather along dimension 0, but all '
174
+ 9541.9s 174 Translated: We're a bunch of sandbags and he's doing that, and that's a very important thing to do.
175
+ 9578.0s 175 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
176
+ 9578.0s 176 warnings.warn('Was asked to gather along dimension 0, but all '
177
+ 9777.2s 177 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
178
+ 9777.2s 178 warnings.warn('Was asked to gather along dimension 0, but all '
179
+ 9939.5s 179 Translated: We're just the sex and the way you see, so that the brain is not going to be a human.
180
+ 9975.6s 180 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
181
+ 9975.6s 181 warnings.warn('Was asked to gather along dimension 0, but all '
182
+ 10174.1s 182 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
183
+ 10174.1s 183 warnings.warn('Was asked to gather along dimension 0, but all '
184
+ 10336.1s 184 Translated: We are the sexy, and he's a sexier, and that's the best way to get a good sex.
185
+ 10371.7s 185 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
186
+ 10371.7s 186 warnings.warn('Was asked to gather along dimension 0, but all '
187
+ 10569.8s 187 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
188
+ 10569.8s 188 warnings.warn('Was asked to gather along dimension 0, but all '
189
+ 10732.4s 189 Translated: We're the ones that are sanding and sanding and letting him go, which are the most important things in the world.
190
+ 10769.0s 190 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
191
+ 10769.0s 191 warnings.warn('Was asked to gather along dimension 0, but all '
192
+ 10966.2s 192 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
193
+ 10966.2s 193 warnings.warn('Was asked to gather along dimension 0, but all '
194
+ 11128.5s 194 Translated: We're the only bifths and he's doing this, and that's the most important part of the equation.
195
+ 11164.4s 195 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
196
+ 11164.4s 196 warnings.warn('Was asked to gather along dimension 0, but all '
197
+ 11363.5s 197 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
198
+ 11363.5s 198 warnings.warn('Was asked to gather along dimension 0, but all '
199
+ 11526.1s 199 Translated: We're the people who've been there and he's here, and that's what we've done for our clients.
200
+ 11562.4s 200 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
201
+ 11562.4s 201 warnings.warn('Was asked to gather along dimension 0, but all '
202
+ 11759.5s 202 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
203
+ 11759.5s 203 warnings.warn('Was asked to gather along dimension 0, but all '
204
+ 11922.0s 204 Translated: We are a bunch of sandbags and he's doing it. We're a bunch of sandbags and sandbags.
205
+ 11957.5s 205 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
206
+ 11957.5s 206 warnings.warn('Was asked to gather along dimension 0, but all '
207
+ 12154.4s 207 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
208
+ 12154.4s 208 warnings.warn('Was asked to gather along dimension 0, but all '
209
+ 12316.8s 209 Translated: We're the people who've been doing this, and we're going to be able to do this.
210
+ 12352.2s 210 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
211
+ 12352.2s 211 warnings.warn('Was asked to gather along dimension 0, but all '
212
+ 12550.1s 212 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
213
+ 12550.1s 213 warnings.warn('Was asked to gather along dimension 0, but all '
214
+ 12713.1s 214 Translated: We're the syringes that he's been able to see, and that's a very good way to see the syringes that he's
215
+ 12748.7s 215 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
216
+ 12748.7s 216 warnings.warn('Was asked to gather along dimension 0, but all '
217
+ 12946.4s 217 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
218
+ 12946.4s 218 warnings.warn('Was asked to gather along dimension 0, but all '
219
+ 13108.5s 219 Translated: We are the sexy and the sexy, and he's doing that, so that the sex of the sexy is a very, very important part of the world
220
+ 13144.8s 220 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
221
+ 13144.8s 221 warnings.warn('Was asked to gather along dimension 0, but all '
222
+ 13342.4s 222 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
223
+ 13342.4s 223 warnings.warn('Was asked to gather along dimension 0, but all '
224
+ 13504.7s 224 Translated: We're the ones who've got the power and the power to do that, which are the most important things to do.
225
+ 13540.8s 225 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
226
+ 13540.8s 226 warnings.warn('Was asked to gather along dimension 0, but all '
227
+ 13737.9s 227 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
228
+ 13737.9s 228 warnings.warn('Was asked to gather along dimension 0, but all '
229
+ 13899.2s 229 Translated: We're a team of scientists and we're able to figure out how to make a better decision.
230
+ 13935.2s 230 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
231
+ 13935.2s 231 warnings.warn('Was asked to gather along dimension 0, but all '
232
+ 14131.6s 232 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
233
+ 14131.6s 233 warnings.warn('Was asked to gather along dimension 0, but all '
234
+ 14293.5s 234 Translated: We are the sex that you're going to be, and you're going to be able to do that.
235
+ 14329.0s 235 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
236
+ 14329.0s 236 warnings.warn('Was asked to gather along dimension 0, but all '
237
+ 14526.6s 237 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
238
+ 14526.6s 238 warnings.warn('Was asked to gather along dimension 0, but all '
239
+ 14688.8s 239 Translated: We're the ones that's going to be, and he's going to be able to do that.
240
+ 14724.9s 240 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
241
+ 14724.9s 241 warnings.warn('Was asked to gather along dimension 0, but all '
242
+ 14922.3s 242 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
243
+ 14922.3s 243 warnings.warn('Was asked to gather along dimension 0, but all '
244
+ 15084.1s 244 Translated: We were the people who've been a little bit, and he was so, so he was a little bit a bit, but he was a little bit, and he was
245
+ 15120.0s 245 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
246
+ 15120.0s 246 warnings.warn('Was asked to gather along dimension 0, but all '
247
+ 15317.2s 247 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
248
+ 15317.2s 248 warnings.warn('Was asked to gather along dimension 0, but all '
249
+ 15479.1s 249 Translated: We are a bunch of sex and sex, and that is why we're not able to make a difference.
250
+ 15514.6s 250 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
251
+ 15514.6s 251 warnings.warn('Was asked to gather along dimension 0, but all '
252
+ 15712.1s 252 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
253
+ 15712.1s 253 warnings.warn('Was asked to gather along dimension 0, but all '
254
+ 15874.2s 254 Translated: We're a group of people who are able to do this, do this by allowing them to do the same thing.
255
+ 15909.9s 255 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
256
+ 15909.9s 256 warnings.warn('Was asked to gather along dimension 0, but all '
257
+ 16107.7s 257 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
258
+ 16107.7s 258 warnings.warn('Was asked to gather along dimension 0, but all '
259
+ 16270.6s 259 Translated: We are a group of scientists and we've seen that this is a re-engineering of the brain.
260
+ 16306.1s 260 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
261
+ 16306.1s 261 warnings.warn('Was asked to gather along dimension 0, but all '
262
+ 16504.3s 262 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
263
+ 16504.3s 263 warnings.warn('Was asked to gather along dimension 0, but all '
264
+ 16554.8s 264 /opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py:2930: FutureWarning: --Exporter.preprocessors=["remove_papermill_header.RemovePapermillHeader"] for containers is deprecated in traitlets 5.0. You can pass `--Exporter.preprocessors item` ... multiple times to add items to a list.
265
+ 16554.8s 265 warn(
266
+ 16554.8s 266 [NbConvertApp] WARNING | Config option `kernel_spec_manager_class` not recognized by `NbConvertApp`.
267
+ 16554.8s 267 [NbConvertApp] Converting notebook __notebook__.ipynb to notebook
268
+ 16555.3s 268 [NbConvertApp] Writing 201642 bytes to __notebook__.ipynb
269
+ 16556.9s 269 /opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py:2930: FutureWarning: --Exporter.preprocessors=["nbconvert.preprocessors.ExtractOutputPreprocessor"] for containers is deprecated in traitlets 5.0. You can pass `--Exporter.preprocessors item` ... multiple times to add items to a list.
270
+ 16556.9s 270 warn(
271
+ 16556.9s 271 [NbConvertApp] WARNING | Config option `kernel_spec_manager_class` not recognized by `NbConvertApp`.
272
+ 16557.0s 272 [NbConvertApp] Converting notebook __notebook__.ipynb to html
273
+ 16558.0s 273 [NbConvertApp] Writing 458182 bytes to __results__.html
model/vi_en/Translation_vi_en_baseline/predict.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, Seq2SeqTrainer, Seq2SeqTrainingArguments, DataCollatorForSeq2Seq
3
+ import sacrebleu
4
+ from rouge_score import rouge_scorer
5
+ import numpy as np
6
+ import html
7
+ from datasets import Dataset
8
+ import pandas as pd
9
+
10
+ SRC = 'vi'
11
+ TRG = 'en'
12
+ KIND = 'baseline'
13
+
14
+ def load_file(file_path):
15
+ lang = []
16
+
17
+ with open(file_path, "r", encoding="utf-8") as file:
18
+ content_en = file.read()
19
+ lang += content_en.split('\n')
20
+ lang = [html.unescape(sent) for sent in lang]
21
+ return lang
22
+
23
+ #tải model:
24
+ name_model = f"NguyenManhAI/translation-{SRC}-{TRG}-{KIND}"
25
+ model = AutoModelForSeq2SeqLM.from_pretrained(name_model)
26
+ tokenizer = AutoTokenizer.from_pretrained(name_model)
27
+
28
+ list_test = dict()
29
+ list_test[SRC] = load_file(f"../data/test/{SRC}-2013.{SRC}")
30
+ list_test[TRG] = load_file(f"../data/test/{TRG}-2013.{TRG}")
31
+
32
+ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
33
+ def predict(model, input_sentence, tokenizer):
34
+ # Dịch một câu hoàn chỉnh
35
+ # Token hóa câu đầu vào
36
+ inputs = tokenizer(input_sentence, return_tensors="pt", padding=True, truncation=True).to(device)
37
+
38
+ # Sử dụng mô hình để dự đoán
39
+ with torch.no_grad():
40
+ outputs = model.generate(**inputs, max_new_tokens = 50)
41
+
42
+ # Giải mã đầu ra của mô hình
43
+ translated_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True)
44
+ return translated_sentence
45
+
46
+ if __name__ == "__main__":
47
+ sentence = {
48
+ 'en': "I'm a doctor and so he is",
49
+ 'vi': "Tôi là một bác sĩ và anh ấy cũng vậy."
50
+ }
51
+
52
+ pred = predict(model, sentence[SRC], tokenizer)
53
+ print(pred)
54
+
55
+ translation = {
56
+ 'inputs':[],
57
+ 'preds':[],
58
+ 'labels':[]
59
+ }
60
+
61
+ for i in range(len(list_test[SRC])):
62
+ translation['inputs'].append(list_test[SRC][i])
63
+ translation['preds'].append(predict(model, list_test[SRC][i], tokenizer))
64
+ translation['labels'].append(list_test[TRG][i])
65
+
66
+ # Tính BLEU
67
+ bleu = sacrebleu.corpus_bleu(translation['preds'], [translation['labels']])
68
+ # Tính TER
69
+ ter = sacrebleu.corpus_ter(translation['preds'], [translation['labels']])
70
+ # Tính CHRF
71
+ chrf = sacrebleu.corpus_chrf(translation['preds'], [translation['labels']])
72
+
73
+ # Tính ROUGE
74
+ scorer = rouge_scorer.RougeScorer(['rouge1', 'rougeL'], use_stemmer=True)
75
+ rouge1_scores = []
76
+ rougeL_scores = []
77
+ for pred, label in zip(translation['preds'], translation['labels']):
78
+ scores = scorer.score(pred, label)
79
+ rouge1_scores.append(scores['rouge1'].fmeasure)
80
+ rougeL_scores.append(scores['rougeL'].fmeasure)
81
+
82
+ avg_rouge1 = sum(rouge1_scores) / len(rouge1_scores)
83
+ avg_rougeL = sum(rougeL_scores) / len(rougeL_scores)
84
+
85
+ metric_str = f"bleu\tter\tchrf\trouge1\trougeL\n{bleu.score}\t{ter.score}\t{chrf.score}\t{avg_rouge1}\t{avg_rougeL}"
86
+
87
+ f = open('final-result\metric.txt', 'w', encoding='utf-8')
88
+ f.write(metric_str)
89
+ f.close()
90
+
91
+ pd.DataFrame(translation).to_csv('final-result/translation.csv', index=False)
92
+
93
+ print("Lưu thành công")
model/vi_en/Translation_vi_en_baseline/result/eval-bleu.png ADDED
model/vi_en/Translation_vi_en_baseline/result/eval-loss.png ADDED
model/vi_en/Translation_vi_en_baseline/result/eval-rouge1.png ADDED
model/vi_en/Translation_vi_en_baseline/result/eval-rougeL.png ADDED
model/vi_en/Translation_vi_en_baseline/result/eval-ter.png ADDED
model/vi_en/Translation_vi_en_baseline/result/log-step.csv ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Step Training Loss Validation Loss Bleu Ter Rouge1 Rougel
2
+ 250 2.162800 1.096764 0.521002 104.353476 0.097115 0.086380
3
+ 500 1.143700 1.064587 0.972787 104.639376 0.117235 0.102468
4
+ 750 1.089600 1.050066 1.144112 104.132554 0.126980 0.112194
5
+ 1000 1.095500 1.040642 1.328784 104.972926 0.138211 0.122988
6
+ 1250 1.077500 1.032666 1.388955 102.269872 0.145518 0.128770
7
+ 1500 1.068300 1.026782 1.555567 103.950617 0.146068 0.130340
8
+ 1750 1.061400 1.020347 1.634174 102.642408 0.152532 0.136965
9
+ 2000 1.059200 1.014594 1.648684 103.326836 0.159372 0.141700
10
+ 2250 1.045200 1.009935 1.934424 106.038553 0.164829 0.148806
11
+ 2500 1.027800 1.004518 2.106856 104.188867 0.172647 0.157896
12
+ 2750 1.044800 0.999143 2.252182 102.889322 0.182297 0.165301
13
+ 3000 1.040200 0.994476 2.286156 101.303877 0.186529 0.170626
14
+ 3250 1.037100 0.991590 2.424057 102.083604 0.196336 0.179131
15
+ 3500 1.015200 0.985237 2.609170 102.157245 0.203719 0.185488
16
+ 3750 1.012400 0.981010 2.596388 101.776045 0.204448 0.187336
17
+ 4000 1.019500 0.977570 2.742878 104.678363 0.209052 0.191922
18
+ 4250 1.025800 0.972629 2.925537 102.287199 0.215092 0.197233
19
+ 4500 1.000000 0.968311 3.159274 100.948668 0.222480 0.204713
20
+ 4750 1.003700 0.964684 3.263418 99.579814 0.228125 0.210455
21
+ 5000 1.010100 0.960824 3.486877 99.995668 0.230582 0.212260
22
+ 5250 0.991900 0.958779 3.500702 98.657137 0.231889 0.214064
23
+ 5500 0.986200 0.955309 3.823957 99.670782 0.239526 0.220258
24
+ 5750 0.992500 0.950842 3.957791 99.649123 0.241434 0.222800
25
+ 6000 0.986500 0.948666 4.147657 97.929391 0.247146 0.226243
26
+ 6250 0.983100 0.946322 4.200885 100.121291 0.247239 0.227342
27
+ 6500 0.976400 0.942853 4.429245 98.691791 0.252030 0.231267
28
+ 6750 0.984700 0.940457 4.471030 98.791423 0.252830 0.232217
29
+ 7000 0.970700 0.938063 4.639349 99.514836 0.256978 0.235377
30
+ 7250 0.977000 0.936263 4.613479 97.418237 0.257306 0.236543
31
+ 7500 0.983800 0.932803 4.730498 99.904700 0.257318 0.236944
32
+ 7750 0.974600 0.932237 4.689001 97.058696 0.264800 0.242410
33
+ 8000 0.982100 0.930422 4.797095 97.556855 0.262845 0.242977
34
+ 8250 0.971100 0.926964 4.876241 97.786441 0.264538 0.243591
35
+ 8500 0.976700 0.926563 5.062710 96.790123 0.267151 0.245411
36
+ 8750 0.960000 0.923590 5.135575 97.370587 0.268811 0.246734
37
+ 9000 0.962200 0.922137 5.149504 97.132337 0.271476 0.249216
38
+ 9250 0.948600 0.920217 5.158302 97.847087 0.270111 0.248074
39
+ 9500 0.946600 0.918721 5.255235 96.664501 0.276053 0.253240
40
+ 9750 0.983000 0.917190 5.232128 97.028373 0.270919 0.249986
41
+ 10000 0.941000 0.915332 5.371734 97.128005 0.276630 0.254165
42
+ 10250 0.940500 0.913624 5.304853 96.248646 0.276222 0.255653
43
+ 10500 0.941500 0.911483 5.311787 96.101365 0.275278 0.254983
44
+ 10750 0.951100 0.910313 5.406396 96.850769 0.277876 0.256696
45
+ 11000 0.950500 0.908519 5.437185 96.136019 0.279347 0.258320
46
+ 11250 0.949200 0.906529 5.585474 96.829110 0.280056 0.259370
47
+ 11500 0.948500 0.905569 5.678242 96.049383 0.282678 0.261651
48
+ 11750 0.949500 0.904321 5.666465 95.183019 0.284296 0.263200
49
+ 12000 0.953400 0.902542 5.919460 94.702188 0.286185 0.264932
50
+ 12250 0.932400 0.900189 5.983293 95.005415 0.287151 0.265885
51
+ 12500 0.935700 0.899032 5.913210 95.611869 0.286351 0.266147
52
+ 12750 0.927200 0.898225 6.013556 94.303660 0.289677 0.268971
53
+ 13000 0.918400 0.896513 6.100141 94.598224 0.293202 0.270746
54
+ 13250 0.937100 0.894367 6.191479 94.758501 0.294896 0.273535
55
+ 13500 0.939600 0.892980 6.282865 94.611219 0.295250 0.273358
56
+ 13750 0.931300 0.891514 6.394785 94.966428 0.294615 0.272930
57
+ 14000 0.927700 0.889602 6.422581 93.753520 0.296687 0.275030
58
+ 14250 0.927100 0.889284 6.463763 92.804852 0.298272 0.277021
59
+ 14500 0.924200 0.887662 6.468736 93.367988 0.300921 0.278548
60
+ 14750 0.936800 0.887166 6.590380 92.869829 0.303396 0.280628
61
+ 15000 0.923300 0.885458 6.710997 93.229370 0.302946 0.281368
62
+ 15250 0.932800 0.884523 6.659118 92.354343 0.303855 0.282822
63
+ 15500 0.926700 0.883579 6.636608 92.982456 0.307451 0.284401
64
+ 15750 0.929400 0.882204 6.794384 92.913147 0.307402 0.285422
65
+ 16000 0.918200 0.881679 6.828677 93.688542 0.306167 0.285251
66
+ 16250 0.911400 0.880150 7.025828 93.597574 0.311014 0.287639
67
+ 16500 0.918600 0.879039 6.968754 93.056097 0.308306 0.286065
68
+ 16750 0.924700 0.877975 7.028111 92.965129 0.312406 0.290047
69
+ 17000 0.910400 0.876075 7.039844 92.869829 0.312418 0.290133
70
+ 17250 0.923800 0.875409 7.095285 92.865497 0.313706 0.290889
71
+ 17500 0.924600 0.874102 7.095179 93.584579 0.313220 0.290764
72
+ 17750 0.919400 0.873187 7.069994 91.734893 0.315221 0.292503
73
+ 18000 0.906400 0.873060 7.238890 91.825861 0.317262 0.293862
74
+ 18250 0.915500 0.872317 7.372920 93.073424 0.316635 0.293071
75
+ 18500 0.913600 0.871288 7.363137 92.332684 0.316608 0.292588
76
+ 18750 0.915400 0.870704 7.423542 92.124756 0.319158 0.295239
77
+ 19000 0.898400 0.869710 7.353194 91.388347 0.319544 0.296007
78
+ 19250 0.916700 0.868732 7.416243 91.124107 0.319153 0.296462
79
+ 19500 0.906900 0.868249 7.495710 91.427334 0.321546 0.297136
80
+ 19750 0.903300 0.867699 7.519833 92.423652 0.318237 0.296803
81
+ 20000 0.900900 0.865547 7.651260 92.570934 0.321265 0.298595
82
+ 20250 0.913400 0.865128 7.685165 91.825861 0.323293 0.299880
83
+ 20500 0.898300 0.864656 7.600324 91.371020 0.325556 0.302711
84
+ 20750 0.893400 0.863313 7.628489 90.760234 0.326127 0.303701
85
+ 21000 0.902500 0.862506 7.785776 91.587611 0.325120 0.302070
86
+ 21250 0.904100 0.862460 7.859648 91.665584 0.325581 0.302581
87
+ 21500 0.903100 0.861502 7.982175 91.193416 0.329159 0.305624
88
+ 21750 0.900000 0.861402 7.969100 90.660602 0.328988 0.305583
89
+ 22000 0.893800 0.861094 7.911027 89.824561 0.330537 0.307777
90
+ 22250 0.920000 0.859362 7.938974 91.392679 0.327932 0.305914
91
+ 22500 0.894100 0.859042 7.999565 91.041802 0.328333 0.306446
92
+ 22750 0.895000 0.858522 8.048814 91.353693 0.330324 0.307460
93
+ 23000 0.887700 0.858366 8.029933 90.578298 0.332386 0.308916
94
+ 23250 0.885600 0.858286 8.023738 90.820879 0.331859 0.309072
95
+ 23500 0.895100 0.857086 7.911901 90.721248 0.331483 0.308586
96
+ 23750 0.891800 0.855909 8.050600 90.916179 0.334184 0.311047
97
+ 24000 0.901700 0.855648 8.134091 90.032489 0.334144 0.310884
98
+ 24250 0.897100 0.854585 8.099106 90.604288 0.334423 0.311011
99
+ 24500 0.896200 0.854505 8.187052 90.305393 0.333490 0.310828
100
+ 24750 0.896900 0.854169 8.173603 89.937189 0.335848 0.313233
101
+ 25000 0.898900 0.852993 8.120007 90.898852 0.333216 0.310587
102
+ 25250 0.888600 0.852599 8.222215 90.465670 0.333940 0.311948
103
+ 25500 0.897600 0.852584 8.273651 90.054148 0.336888 0.313601
104
+ 25750 0.904500 0.851544 8.262491 90.127789 0.336545 0.314068
105
+ 26000 0.883900 0.852164 8.333018 89.590643 0.340138 0.317341
106
+ 26250 0.904600 0.850994 8.404498 89.941520 0.339479 0.316496
107
+ 26500 0.893500 0.849719 8.425117 90.015161 0.340811 0.317534
108
+ 26750 0.879400 0.849673 8.353224 89.482348 0.340142 0.316822
109
+ 27000 0.884200 0.849171 8.425437 89.473684 0.342311 0.318182
110
+ 27250 0.890100 0.848787 8.562850 89.317739 0.340850 0.317320
111
+ 27500 0.877100 0.848616 8.473004 89.685943 0.340169 0.317295
112
+ 27750 0.880100 0.848448 8.529262 89.148798 0.343104 0.319841
113
+ 28000 0.889100 0.848052 8.436810 89.538661 0.341855 0.318681
114
+ 28250 0.879800 0.847456 8.511029 90.123457 0.342883 0.319200
115
+ 28500 0.884500 0.846745 8.508162 89.846220 0.341917 0.318477
116
+ 28750 0.883400 0.846680 8.532116 89.222439 0.342470 0.319258
117
+ 29000 0.904200 0.846338 8.543308 90.127789 0.342719 0.318851
118
+ 29250 0.875500 0.846741 8.567820 89.226771 0.342682 0.319640
119
+ 29500 0.871600 0.846246 8.602180 89.135802 0.344052 0.321016
120
+ 29750 0.885600 0.845252 8.579718 89.400043 0.344634 0.321395
121
+ 30000 0.879700 0.844419 8.536548 89.460689 0.344410 0.320758
122
+ 30250 0.878500 0.845313 8.536589 89.404375 0.345327 0.321948
123
+ 30500 0.883800 0.844427 8.629667 89.088152 0.347419 0.323359
124
+ 30750 0.888900 0.843956 8.817481 89.023175 0.346058 0.323177
125
+ 31000 0.871800 0.843607 8.654749 89.148798 0.345464 0.321918
126
+ 31250 0.883100 0.843170 8.699456 89.707602 0.346530 0.322785
127
+ 31500 0.880700 0.842924 8.840148 88.468703 0.347810 0.324866
128
+ 31750 0.888900 0.843414 8.848738 88.832575 0.347306 0.324164
129
+ 32000 0.879600 0.842126 8.806663 88.992853 0.347291 0.323649
130
+ 32250 0.883500 0.842140 8.901572 88.780593 0.348111 0.324213
131
+ 32500 0.885000 0.841959 8.831040 88.702621 0.347905 0.324150
132
+ 32750 0.885200 0.842284 8.792857 88.780593 0.348569 0.324910
133
+ 33000 0.889000 0.841729 8.736697 89.261425 0.346355 0.323071
134
+ 33250 0.873100 0.841311 8.883506 89.421702 0.346563 0.323725
135
+ 33500 0.877700 0.841128 8.997192 89.443361 0.348613 0.324841
136
+ 33750 0.879900 0.840942 8.886926 89.001516 0.349764 0.326112
137
+ 34000 0.873400 0.840681 8.918032 88.771930 0.349972 0.325095
138
+ 34250 0.879600 0.840439 8.922654 88.940871 0.348729 0.324922
139
+ 34500 0.884800 0.839981 8.899336 89.326402 0.348315 0.324284
140
+ 34750 0.877100 0.840125 8.932014 88.828243 0.348965 0.325449
141
+ 35000 0.889600 0.839630 8.946335 88.512021 0.348552 0.325704
142
+ 35250 0.884700 0.839929 8.928207 89.135802 0.346932 0.323808
143
+ 35500 0.873300 0.839313 8.966172 89.031839 0.348139 0.324217
144
+ 35750 0.883800 0.839204 8.939611 89.174789 0.347672 0.324484
145
+ 36000 0.873700 0.839596 9.028072 88.434048 0.350062 0.326299
146
+ 36250 0.869000 0.838991 9.046147 88.641975 0.350363 0.327078
147
+ 36500 0.879600 0.838835 9.083944 88.317089 0.351520 0.328380
148
+ 36750 0.877400 0.838707 9.066646 88.421053 0.350998 0.327455
149
+ 37000 0.867300 0.838474 9.031699 88.351744 0.350943 0.327230
150
+ 37250 0.868600 0.838576 9.017844 88.481698 0.350245 0.327009
151
+ 37500 0.880400 0.838647 9.023358 88.109162 0.351545 0.327698
152
+ 37750 0.867200 0.838255 8.994065 88.247780 0.350714 0.326740
153
+ 38000 0.871700 0.838353 8.969140 88.546675 0.349989 0.325947
154
+ 38250 0.887300 0.838197 9.043189 88.447044 0.350476 0.326348
155
+ 38500 0.866900 0.838110 8.966639 88.468703 0.350294 0.325674
156
+ 38750 0.881300 0.838204 9.025368 88.295430 0.350948 0.326794
157
+ 39000 0.871200 0.837942 9.031211 88.438380 0.350358 0.326644
158
+ 39250 0.877800 0.838027 9.041395 88.356075 0.350875 0.327120
159
+ 39500 0.858500 0.837755 9.093698 88.139485 0.351147 0.327372
160
+ 39750 0.865600 0.837578 9.098669 88.299762 0.351330 0.327553
161
+ 40000 0.871600 0.837668 9.093030 88.317089 0.351311 0.327984
162
+ 40250 0.879700 0.837648 9.075355 88.334416 0.350948 0.327337
163
+ 40500 0.875000 0.837609 9.078352 88.057180 0.351333 0.327603
164
+ 40750 0.865000 0.837585 9.083667 87.983539 0.351971 0.328305
165
+ 41000 0.883100 0.837574 9.097668 88.009530 0.351911 0.328246
166
+ 41250 0.885300 0.837613 9.095008 87.862248 0.352106 0.328451
167
+ 41500 0.878700 0.837610 9.096285 87.801603 0.352499 0.328780
model/vi_en/Translation_vi_en_baseline/result/train-loss.png ADDED
model/vi_en/Translation_vi_en_baseline/train.py ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, Seq2SeqTrainer, Seq2SeqTrainingArguments, DataCollatorForSeq2Seq
3
+ import sacrebleu
4
+ from rouge_score import rouge_scorer
5
+ import numpy as np
6
+ import html
7
+ from datasets import Dataset
8
+
9
+ SRC = 'vi'
10
+ TRG = 'en'
11
+ KIND = 'baseline'
12
+ name_model = "google-t5/t5-small"
13
+
14
+ # load dữ liệu
15
+ def load_file(file_path):
16
+ lang = []
17
+
18
+ with open(file_path, "r", encoding="utf-8") as file:
19
+ content_en = file.read()
20
+ lang += content_en.split('\n')
21
+ lang = [html.unescape(sent) for sent in lang]
22
+ return lang
23
+
24
+ list_train = dict()
25
+ list_train[SRC] = load_file(f"../data/train/{SRC}.{SRC}")
26
+ list_train[TRG] = load_file(f"../data/train/{TRG}.{TRG}")
27
+
28
+ list_test = dict()
29
+ list_test[SRC] = load_file(f"../data/test/{SRC}-2013.{SRC}")
30
+ list_test[TRG] = load_file(f"../data/test/{TRG}-2013.{TRG}")
31
+
32
+ list_dev = dict()
33
+ list_dev[SRC] = load_file(f"../data/dev/{SRC}-2012.{SRC}")
34
+ list_dev[TRG] = load_file(f"../data/dev/{TRG}-2012.{TRG}")
35
+
36
+
37
+ dataset_train = Dataset.from_dict({"source": list_train[SRC], "target": list_train})
38
+ dataset_test = Dataset.from_dict({"source": list_test[SRC], "target": list_test[TRG]})
39
+ dataset_dev = Dataset.from_dict({"source": list_dev[SRC], "target": list_dev[TRG]})
40
+
41
+ #tải model:
42
+ model = AutoModelForSeq2SeqLM.from_pretrained(name_model)
43
+ tokenizer = AutoTokenizer.from_pretrained(name_model)
44
+
45
+ #tạo các phương thức cần thiết:
46
+ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
47
+ def predict(model, input_sentence, tokenizer):
48
+ # Dịch một câu hoàn chỉnh
49
+ # Token hóa câu đầu vào
50
+ inputs = tokenizer(input_sentence, return_tensors="pt", padding=True, truncation=True).to(device)
51
+
52
+ # Sử dụng mô hình để dự đoán
53
+ with torch.no_grad():
54
+ outputs = model.generate(**inputs, max_new_tokens = 50)
55
+
56
+ # Giải mã đầu ra của mô hình
57
+ translated_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True)
58
+ return translated_sentence
59
+
60
+ def tokenize_function(examples):
61
+ inputs = [ex for ex in examples['source']]
62
+ targets = [ex for ex in examples['target']]
63
+ model_inputs = tokenizer(inputs, max_length=80, truncation=True, padding="max_length") #80 -> 128
64
+
65
+ # Sử dụng tokenizer để mã hóa câu đích
66
+ with tokenizer.as_target_tokenizer():
67
+ labels = tokenizer(text_target = targets, max_length=80, truncation=True, padding="max_length") # 80 -> 128
68
+
69
+ # Thêm nhãn vào kết quả mã hóa
70
+ model_inputs["labels"] = labels["input_ids"]
71
+
72
+ return model_inputs
73
+
74
+ def compute_metrics(eval_pred):
75
+ predictions, labels = eval_pred
76
+
77
+ predictions = np.array(predictions)
78
+ predictions[predictions < 0] = 0
79
+ predictions = predictions.tolist()
80
+
81
+
82
+ labels = np.array(labels)
83
+ labels[labels < 0] = 0
84
+ labels = labels.tolist()
85
+
86
+ decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=True)
87
+ decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)
88
+
89
+ # Tính BLEU
90
+ bleu = sacrebleu.corpus_bleu(decoded_preds, [decoded_labels])
91
+
92
+ # Tính TER
93
+ ter = sacrebleu.corpus_ter(decoded_preds, [decoded_labels])
94
+
95
+ # Tính CHRF
96
+ chrf = sacrebleu.corpus_chrf(decoded_preds, [decoded_labels])
97
+
98
+ # Tính ROUGE
99
+ scorer = rouge_scorer.RougeScorer(['rouge1', 'rougeL'], use_stemmer=True)
100
+ rouge1_scores = []
101
+ rougeL_scores = []
102
+ for pred, label in zip(decoded_preds, decoded_labels):
103
+ scores = scorer.score(pred, label)
104
+ rouge1_scores.append(scores['rouge1'].fmeasure)
105
+ rougeL_scores.append(scores['rougeL'].fmeasure)
106
+
107
+ avg_rouge1 = sum(rouge1_scores) / len(rouge1_scores)
108
+ avg_rougeL = sum(rougeL_scores) / len(rougeL_scores)
109
+
110
+ return {
111
+ "bleu": bleu.score,
112
+ "ter": ter.score,
113
+ "chrf": chrf.score,
114
+ "rouge1": avg_rouge1,
115
+ "rougeL": avg_rougeL
116
+ }
117
+
118
+ # chuẩn bị dữ liệu:
119
+ tokenized_train = dataset_train.map(tokenize_function, batched=True)
120
+ tokenized_test = dataset_test.map(tokenize_function, batched=True)
121
+
122
+ data_collator = DataCollatorForSeq2Seq(tokenizer, model=model)
123
+
124
+ # thiết lập callback
125
+
126
+ from transformers import TrainerCallback
127
+
128
+ class CustomStepCallback(TrainerCallback):
129
+ def __init__(self, steps_interval, action_method):
130
+ self.steps_interval = steps_interval
131
+ self.action_method = action_method
132
+
133
+ def on_step_end(self, args, state, control, **kwargs):
134
+ # Thực hiện hành động sau mỗi steps_interval bước
135
+ if state.global_step % self.steps_interval == 0:
136
+ self.action_method(state.global_step)
137
+
138
+ # Định nghĩa phương thức hành động
139
+ def custom_action(step):
140
+ sentence = {
141
+ 'vi': "Chúng tôi là những bác sĩ xuất sắc và anh ấy cũng vậy, do đó ca phẫu thuật chắc chắn sẽ thành công.",
142
+ 'en': "We are excellent doctors and so is he, so the surgery will definitely be successful."
143
+ }
144
+ pred = predict(model, sentence[SRC], tokenizer)
145
+ print(f"Translated: {pred}")
146
+
147
+ # Khởi tạo callback với số bước và phương thức hành động
148
+ custom_callback = CustomStepCallback(steps_interval=1000, action_method=custom_action)
149
+
150
+ # thiết lập huấn luyện
151
+ training_args = Seq2SeqTrainingArguments(
152
+ output_dir=f"./results-{SRC}-{TRG}-base",
153
+ evaluation_strategy="steps",
154
+ eval_steps=250, #100 -> 250 x
155
+ learning_rate=3e-5, #3 -> 2
156
+ per_device_train_batch_size=16, #8 -> 16
157
+ per_device_eval_batch_size=16, #8 -> 16
158
+ weight_decay=0.01,
159
+ save_total_limit=3,
160
+ num_train_epochs=10, # 1 -> 10 x
161
+ predict_with_generate=True,
162
+ generation_max_length=50,
163
+ save_steps=500,
164
+ logging_dir="./logs", # Thư mục để lưu logs
165
+ logging_steps=250,
166
+ fp16 = True
167
+ )
168
+
169
+ trainer = Seq2SeqTrainer(
170
+ model=model,
171
+ args=training_args,
172
+ train_dataset=tokenized_train, #dev -> train x
173
+ eval_dataset=tokenized_test,
174
+ tokenizer=tokenizer,
175
+ data_collator=data_collator,
176
+ compute_metrics=compute_metrics,
177
+ callbacks=[custom_callback]
178
+ )
179
+
180
+ if __name__ == "__main__":
181
+ # huấn luyện và lưu lại mô hình
182
+ trainer.train()
183
+ torch.save(model.state_dict(), f"{SRC}-{TRG}-parameters-{KIND}.pth")
model/vi_en/Translation_vi_en_official/final-result/metric.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ bleu ter chrf rouge1 rougeL
2
+ 34.560699310846694 60.135438491469614 55.9835775539685 0.6727860801911647 0.6505821121136771
model/vi_en/Translation_vi_en_official/final-result/translation.csv ADDED
The diff for this file is too large to render. See raw diff
 
model/vi_en/Translation_vi_en_official/log/model-vi-en-official.log ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 8.1s 1 Collecting sacrebleu
2
+ 8.2s 2 Downloading sacrebleu-2.4.2-py3-none-any.whl.metadata (58 kB)
3
+ 8.2s 3 [?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/58.0 kB ? eta -:--:--
4
+ 8.2s 4 [?25hCollecting portalocker (from sacrebleu)
5
+ 8.2s 5 Downloading portalocker-2.10.1-py3-none-any.whl.metadata (8.5 kB)
6
+ 8.3s 6 Requirement already satisfied: regex in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (2023.12.25)
7
+ 8.3s 7 Requirement already satisfied: tabulate>=0.8.9 in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (0.9.0)
8
+ 8.3s 8 Requirement already satisfied: numpy>=1.17 in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (1.26.4)
9
+ 8.3s 9 Requirement already satisfied: colorama in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (0.4.6)
10
+ 8.3s 10 Requirement already satisfied: lxml in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (5.2.2)
11
+ 8.3s 11 Downloading sacrebleu-2.4.2-py3-none-any.whl (106 kB)
12
+ 8.3s 12 [?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/106.7 kB ? eta -:--:--
13
+ 8.3s 13 [?25hDownloading portalocker-2.10.1-py3-none-any.whl (18 kB)
14
+ 18.8s 14 Installing collected packages: portalocker, sacrebleu
15
+ 19.1s 15 Successfully installed portalocker-2.10.1 sacrebleu-2.4.2
16
+ 20.2s 16 Collecting rouge-score
17
+ 20.3s 17 Downloading rouge_score-0.1.2.tar.gz (17 kB)
18
+ 21.3s 18 Preparing metadata (setup.py) ... [?25l- done
19
+ 21.3s 19 [?25hRequirement already satisfied: absl-py in /opt/conda/lib/python3.10/site-packages (from rouge-score) (1.4.0)
20
+ 21.3s 20 Requirement already satisfied: nltk in /opt/conda/lib/python3.10/site-packages (from rouge-score) (3.2.4)
21
+ 21.3s 21 Requirement already satisfied: numpy in /opt/conda/lib/python3.10/site-packages (from rouge-score) (1.26.4)
22
+ 21.3s 22 Requirement already satisfied: six>=1.14.0 in /opt/conda/lib/python3.10/site-packages (from rouge-score) (1.16.0)
23
+ 21.3s 23 Building wheels for collected packages: rouge-score
24
+ 22.7s 24 Building wheel for rouge-score (setup.py) ... [?25l- \ done
25
+ 22.7s 25 [?25h Created wheel for rouge-score: filename=rouge_score-0.1.2-py3-none-any.whl size=24934 sha256=33cef78cf4d499c2e86605775b648e5d90bd668a912195b52b03c3d196cb4e10
26
+ 22.7s 26 Stored in directory: /root/.cache/pip/wheels/5f/dd/89/461065a73be61a532ff8599a28e9beef17985c9e9c31e541b4
27
+ 22.7s 27 Successfully built rouge-score
28
+ 32.6s 28 Installing collected packages: rouge-score
29
+ 32.9s 29 Successfully installed rouge-score-0.1.2
30
+ 33.2s 30 Note: you may need to restart the kernel to use updated packages.
31
+ 40.1s 31 2024-08-05 06:18:30.760235: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
32
+ 40.1s 32 2024-08-05 06:18:30.760332: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
33
+ 40.1s 33 2024-08-05 06:18:30.882476: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
34
+ 40.3s 34 2024-08-05 06:18:30.760235: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
35
+ 40.3s 35 2024-08-05 06:18:30.760332: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
36
+ 40.3s 36 2024-08-05 06:18:30.882476: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
37
+ 54.8s 37 /opt/conda/lib/python3.10/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
38
+ 54.8s 38 return self.fget.__get__(instance, owner)()
39
+ 58.6s 39 /opt/conda/lib/python3.10/site-packages/transformers/models/marian/tokenization_marian.py:175: UserWarning: Recommended: pip install sacremoses.
40
+ 58.6s 40 warnings.warn("Recommended: pip install sacremoses.")
41
+ 60.3s 41 /opt/conda/lib/python3.10/site-packages/transformers/tokenization_utils_base.py:4016: UserWarning: `as_target_tokenizer` is deprecated and will be removed in v5 of Transformers. You can tokenize your labels by using the argument `text_target` of the regular `__call__` method (either in the same call as your input texts if you use the same keyword arguments, or in a separate call.
42
+ 60.3s 42 warnings.warn(
43
+ 113.7s 43 wandb: W&B API key is configured. Use `wandb login --relogin` to force relogin
44
+ 113.7s 44 wandb: WARNING If you're specifying your api key in code, ensure this code is not shared publicly.
45
+ 113.7s 45 wandb: WARNING Consider setting the WANDB_API_KEY environment variable, or running `wandb login` from the command line.
46
+ 113.7s 46 wandb: Appending key for api.wandb.ai to your netrc file: /root/.netrc
47
+ 114.2s 47 /opt/conda/lib/python3.10/site-packages/transformers/training_args.py:1494: FutureWarning: `evaluation_strategy` is deprecated and will be removed in version 4.46 of 🤗 Transformers. Use `eval_strategy` instead
48
+ 114.2s 48 warnings.warn(
49
+ 115.3s 49 wandb: WARNING The `run_name` is currently set to the same value as `TrainingArguments.output_dir`. If this was not intended, please specify a different run name by setting the `TrainingArguments.run_name` parameter.
50
+ 115.3s 50 wandb: Currently logged in as: lananhmtms1 (lananhmtms1-mtms1). Use `wandb login --relogin` to force relogin
51
+ 130.9s 51 wandb: wandb version 0.17.5 is available! To upgrade, please run:
52
+ 130.9s 52 wandb: $ pip install wandb --upgrade
53
+ 130.9s 53 wandb: Tracking run with wandb version 0.17.4
54
+ 130.9s 54 wandb: Run data is saved locally in /kaggle/working/wandb/run-20240805_061946-6xsf6my3
55
+ 130.9s 55 wandb: Run `wandb offline` to turn off syncing.
56
+ 130.9s 56 wandb: Syncing run ./results-vi-en
57
+ 130.9s 57 wandb: ⭐️ View project at https://wandb.ai/lananhmtms1-mtms1/huggingface
58
+ 130.9s 58 wandb: 🚀 View run at https://wandb.ai/lananhmtms1-mtms1/huggingface/runs/6xsf6my3
59
+ 133.7s 59 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
60
+ 133.7s 60 warnings.warn('Was asked to gather along dimension 0, but all '
61
+ 463.2s 61 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
62
+ 463.2s 62 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
63
+ 465.0s 63 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
64
+ 465.0s 64 warnings.warn('Was asked to gather along dimension 0, but all '
65
+ 704.1s 65 Translated: We're brilliant doctors, and so is he, so the operation is definitely going to work.
66
+ 797.8s 66 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
67
+ 797.8s 67 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
68
+ 799.6s 68 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
69
+ 799.6s 69 warnings.warn('Was asked to gather along dimension 0, but all '
70
+ 1132.4s 70 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
71
+ 1132.4s 71 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
72
+ 1134.3s 72 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
73
+ 1134.3s 73 warnings.warn('Was asked to gather along dimension 0, but all '
74
+ 1373.1s 74 Translated: We're great doctors, and so is he, so the surgery is definitely going to work.
75
+ 1467.5s 75 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
76
+ 1467.5s 76 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
77
+ 1469.4s 77 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
78
+ 1469.4s 78 warnings.warn('Was asked to gather along dimension 0, but all '
79
+ 1801.8s 79 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
80
+ 1801.8s 80 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
81
+ 1803.7s 81 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
82
+ 1803.7s 82 warnings.warn('Was asked to gather along dimension 0, but all '
83
+ 2043.0s 83 Translated: We're great doctors, and so is he, so the surgery is going to work.
84
+ 2137.8s 84 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
85
+ 2137.8s 85 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
86
+ 2139.7s 86 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
87
+ 2139.7s 87 warnings.warn('Was asked to gather along dimension 0, but all '
88
+ 2473.5s 88 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
89
+ 2473.5s 89 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
90
+ 2475.5s 90 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
91
+ 2475.5s 91 warnings.warn('Was asked to gather along dimension 0, but all '
92
+ 2713.8s 92 Translated: We're excellent doctors, and so is he, so the surgery is going to work.
93
+ 2808.4s 93 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
94
+ 2808.4s 94 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
95
+ 2810.4s 95 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
96
+ 2810.4s 96 warnings.warn('Was asked to gather along dimension 0, but all '
97
+ 3143.7s 97 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
98
+ 3143.7s 98 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
99
+ 3145.6s 99 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
100
+ 3145.6s 100 warnings.warn('Was asked to gather along dimension 0, but all '
101
+ 3385.5s 101 Translated: We're excellent doctors, and so is he, so the operation will definitely succeed.
102
+ 3479.2s 102 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
103
+ 3479.2s 103 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
104
+ 3481.1s 104 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
105
+ 3481.1s 105 warnings.warn('Was asked to gather along dimension 0, but all '
106
+ 3813.5s 106 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
107
+ 3813.5s 107 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
108
+ 3815.4s 108 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
109
+ 3815.4s 109 warnings.warn('Was asked to gather along dimension 0, but all '
110
+ 4054.5s 110 Translated: We were excellent doctors, and so was he, so the surgery was going to work.
111
+ 4148.7s 111 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
112
+ 4148.7s 112 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
113
+ 4150.6s 113 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
114
+ 4150.6s 114 warnings.warn('Was asked to gather along dimension 0, but all '
115
+ 4483.7s 115 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
116
+ 4483.7s 116 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
117
+ 4485.6s 117 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
118
+ 4485.6s 118 warnings.warn('Was asked to gather along dimension 0, but all '
119
+ 4725.0s 119 Translated: We're brilliant doctors, and so is he, so the surgery is certainly going to work.
120
+ 4819.3s 120 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
121
+ 4819.3s 121 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
122
+ 4821.2s 122 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
123
+ 4821.2s 123 warnings.warn('Was asked to gather along dimension 0, but all '
124
+ 5154.5s 124 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
125
+ 5154.5s 125 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
126
+ 5156.4s 126 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
127
+ 5156.4s 127 warnings.warn('Was asked to gather along dimension 0, but all '
128
+ 5395.4s 128 Translated: We're excellent doctors, and he's also, so the surgery is going to work.
129
+ 5488.8s 129 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
130
+ 5488.8s 130 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
131
+ 5490.8s 131 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
132
+ 5490.8s 132 warnings.warn('Was asked to gather along dimension 0, but all '
133
+ 5824.4s 133 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
134
+ 5824.4s 134 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
135
+ 5826.3s 135 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
136
+ 5826.3s 136 warnings.warn('Was asked to gather along dimension 0, but all '
137
+ 6065.9s 137 Translated: We're excellent doctors, and so is he, so the operation will definitely work.
138
+ 6160.2s 138 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
139
+ 6160.2s 139 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
140
+ 6162.2s 140 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
141
+ 6162.2s 141 warnings.warn('Was asked to gather along dimension 0, but all '
142
+ 6495.1s 142 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
143
+ 6495.1s 143 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
144
+ 6497.1s 144 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
145
+ 6497.1s 145 warnings.warn('Was asked to gather along dimension 0, but all '
146
+ 6736.8s 146 Translated: We're excellent doctors, and so is he, so the surgery will definitely work.
147
+ 6831.1s 147 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
148
+ 6831.1s 148 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
149
+ 6833.0s 149 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
150
+ 6833.0s 150 warnings.warn('Was asked to gather along dimension 0, but all '
151
+ 7166.5s 151 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
152
+ 7166.5s 152 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
153
+ 7168.4s 153 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
154
+ 7168.4s 154 warnings.warn('Was asked to gather along dimension 0, but all '
155
+ 7407.9s 155 Translated: We're brilliant doctors, and so is he, so the operation is going to work.
156
+ 7502.1s 156 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
157
+ 7502.1s 157 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
158
+ 7504.0s 158 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
159
+ 7504.0s 159 warnings.warn('Was asked to gather along dimension 0, but all '
160
+ 7837.5s 160 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
161
+ 7837.5s 161 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
162
+ 7839.4s 162 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
163
+ 7839.4s 163 warnings.warn('Was asked to gather along dimension 0, but all '
164
+ 8078.2s 164 Translated: We're brilliant doctors, and he's also, so the surgery will surely work.
165
+ 8172.4s 165 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
166
+ 8172.4s 166 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
167
+ 8174.3s 167 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
168
+ 8174.3s 168 warnings.warn('Was asked to gather along dimension 0, but all '
169
+ 8507.4s 169 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
170
+ 8507.4s 170 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
171
+ 8509.3s 171 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
172
+ 8509.3s 172 warnings.warn('Was asked to gather along dimension 0, but all '
173
+ 8748.2s 173 Translated: We're excellent doctors, and so is he, so the surgery will definitely work.
174
+ 8842.0s 174 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
175
+ 8842.0s 175 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
176
+ 8843.9s 176 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
177
+ 8843.9s 177 warnings.warn('Was asked to gather along dimension 0, but all '
178
+ 9176.2s 178 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
179
+ 9176.2s 179 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
180
+ 9178.1s 180 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
181
+ 9178.1s 181 warnings.warn('Was asked to gather along dimension 0, but all '
182
+ 9417.3s 182 Translated: We are brilliant doctors, and so is he, so the operation is going to work.
183
+ 9512.1s 183 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
184
+ 9512.1s 184 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
185
+ 9514.0s 185 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
186
+ 9514.0s 186 warnings.warn('Was asked to gather along dimension 0, but all '
187
+ 9846.8s 187 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
188
+ 9846.8s 188 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
189
+ 9848.7s 189 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
190
+ 9848.7s 190 warnings.warn('Was asked to gather along dimension 0, but all '
191
+ 10087.5s 191 Translated: We were excellent doctors, and so was he, so the surgery was bound to work.
192
+ 10182.2s 192 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
193
+ 10182.2s 193 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
194
+ 10184.1s 194 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
195
+ 10184.1s 195 warnings.warn('Was asked to gather along dimension 0, but all '
196
+ 10517.6s 196 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
197
+ 10517.6s 197 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
198
+ 10519.5s 198 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
199
+ 10519.5s 199 warnings.warn('Was asked to gather along dimension 0, but all '
200
+ 10758.6s 200 Translated: We're brilliant doctors, and so is he, so the surgery will definitely work.
201
+ 10853.5s 201 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
202
+ 10853.5s 202 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
203
+ 10855.4s 203 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
204
+ 10855.4s 204 warnings.warn('Was asked to gather along dimension 0, but all '
205
+ 11188.1s 205 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
206
+ 11188.1s 206 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
207
+ 11190.1s 207 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
208
+ 11190.1s 208 warnings.warn('Was asked to gather along dimension 0, but all '
209
+ 11429.8s 209 Translated: We were brilliant doctors, and so was he, so the surgery was going to work.
210
+ 11523.7s 210 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
211
+ 11523.7s 211 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
212
+ 11525.6s 212 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
213
+ 11525.6s 213 warnings.warn('Was asked to gather along dimension 0, but all '
214
+ 11859.3s 214 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
215
+ 11859.3s 215 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
216
+ 11861.2s 216 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
217
+ 11861.2s 217 warnings.warn('Was asked to gather along dimension 0, but all '
218
+ 12101.6s 218 Translated: We're excellent doctors, and so is he, so the surgery will surely succeed.
219
+ 12196.0s 219 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
220
+ 12196.0s 220 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
221
+ 12197.9s 221 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
222
+ 12197.9s 222 warnings.warn('Was asked to gather along dimension 0, but all '
223
+ 12531.6s 223 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
224
+ 12531.6s 224 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
225
+ 12533.5s 225 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
226
+ 12533.5s 226 warnings.warn('Was asked to gather along dimension 0, but all '
227
+ 12773.0s 227 Translated: We're excellent doctors, and neither is he, so the surgery is going to be successful.
228
+ 12867.5s 228 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
229
+ 12867.5s 229 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
230
+ 12869.4s 230 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
231
+ 12869.4s 231 warnings.warn('Was asked to gather along dimension 0, but all '
232
+ 13202.8s 232 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
233
+ 13202.8s 233 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
234
+ 13204.7s 234 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
235
+ 13204.7s 235 warnings.warn('Was asked to gather along dimension 0, but all '
236
+ 13444.6s 236 Translated: We're brilliant doctors, and he's also, so the surgery is certainly going to work.
237
+ 13539.2s 237 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
238
+ 13539.2s 238 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
239
+ 13541.2s 239 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
240
+ 13541.2s 240 warnings.warn('Was asked to gather along dimension 0, but all '
241
+ 13874.0s 241 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
242
+ 13874.0s 242 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
243
+ 13875.9s 243 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
244
+ 13875.9s 244 warnings.warn('Was asked to gather along dimension 0, but all '
245
+ 14115.6s 245 Translated: We're excellent doctors, and so is he, so the surgery is certainly going to work.
246
+ 14209.7s 246 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
247
+ 14209.7s 247 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
248
+ 14211.7s 248 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
249
+ 14211.7s 249 warnings.warn('Was asked to gather along dimension 0, but all '
250
+ 14545.1s 250 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
251
+ 14545.1s 251 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
252
+ 14547.0s 252 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
253
+ 14547.0s 253 warnings.warn('Was asked to gather along dimension 0, but all '
254
+ 14786.0s 254 Translated: We're brilliant doctors, and so is he, so the surgery is going to work.
255
+ 14880.6s 255 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
256
+ 14880.6s 256 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
257
+ 14882.5s 257 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
258
+ 14882.5s 258 warnings.warn('Was asked to gather along dimension 0, but all '
259
+ 15215.8s 259 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
260
+ 15215.8s 260 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
261
+ 15217.7s 261 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
262
+ 15217.7s 262 warnings.warn('Was asked to gather along dimension 0, but all '
263
+ 15457.2s 263 Translated: We're very good doctors, and so is he, so the surgery is going to work.
264
+ 15551.9s 264 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
265
+ 15551.9s 265 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
266
+ 15553.8s 266 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
267
+ 15553.8s 267 warnings.warn('Was asked to gather along dimension 0, but all '
268
+ 15886.3s 268 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
269
+ 15886.3s 269 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
270
+ 15888.2s 270 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
271
+ 15888.2s 271 warnings.warn('Was asked to gather along dimension 0, but all '
272
+ 16128.0s 272 Translated: We're brilliant doctors, and so is he, so the surgery will probably work.
273
+ 16221.8s 273 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
274
+ 16221.8s 274 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
275
+ 16223.8s 275 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
276
+ 16223.8s 276 warnings.warn('Was asked to gather along dimension 0, but all '
277
+ 16557.2s 277 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
278
+ 16557.2s 278 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
279
+ 16559.1s 279 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
280
+ 16559.1s 280 warnings.warn('Was asked to gather along dimension 0, but all '
281
+ 16799.3s 281 Translated: We're excellent doctors, and so is he, so the surgery is certainly going to work.
282
+ 16893.2s 282 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
283
+ 16893.2s 283 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
284
+ 16895.1s 284 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
285
+ 16895.1s 285 warnings.warn('Was asked to gather along dimension 0, but all '
286
+ 17228.3s 286 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
287
+ 17228.3s 287 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
288
+ 17230.2s 288 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
289
+ 17230.2s 289 warnings.warn('Was asked to gather along dimension 0, but all '
290
+ 17469.9s 290 Translated: We're excellent doctors, and so is he, so the surgery is definitely going to work.
291
+ 17563.8s 291 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
292
+ 17563.8s 292 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
293
+ 17565.7s 293 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
294
+ 17565.7s 294 warnings.warn('Was asked to gather along dimension 0, but all '
295
+ 17898.7s 295 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
296
+ 17898.7s 296 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
297
+ 17900.7s 297 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
298
+ 17900.7s 298 warnings.warn('Was asked to gather along dimension 0, but all '
299
+ 18139.5s 299 Translated: We're excellent doctors, and so is he, so the operation will surely work.
300
+ 18234.1s 300 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
301
+ 18234.1s 301 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
302
+ 18236.0s 302 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
303
+ 18236.0s 303 warnings.warn('Was asked to gather along dimension 0, but all '
304
+ 18570.0s 304 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
305
+ 18570.0s 305 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
306
+ 18571.9s 306 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
307
+ 18571.9s 307 warnings.warn('Was asked to gather along dimension 0, but all '
308
+ 18811.4s 308 Translated: We're excellent doctors, and so is he, so the operation is bound to be successful.
309
+ 18905.3s 309 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
310
+ 18905.3s 310 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
311
+ 18907.3s 311 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
312
+ 18907.3s 312 warnings.warn('Was asked to gather along dimension 0, but all '
313
+ 19240.7s 313 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
314
+ 19240.7s 314 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
315
+ 19242.7s 315 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
316
+ 19242.7s 316 warnings.warn('Was asked to gather along dimension 0, but all '
317
+ 19482.7s 317 Translated: We're brilliant doctors, and so is he, so the operation will surely work.
318
+ 19577.2s 318 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
319
+ 19577.2s 319 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
320
+ 19579.1s 320 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
321
+ 19579.1s 321 warnings.warn('Was asked to gather along dimension 0, but all '
322
+ 19912.7s 322 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
323
+ 19912.7s 323 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
324
+ 19914.6s 324 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
325
+ 19914.6s 325 warnings.warn('Was asked to gather along dimension 0, but all '
326
+ 20153.9s 326 Translated: We're excellent doctors, and so is he, and so the operation will work.
327
+ 20247.9s 327 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
328
+ 20247.9s 328 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
329
+ 20249.9s 329 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
330
+ 20249.9s 330 warnings.warn('Was asked to gather along dimension 0, but all '
331
+ 20583.0s 331 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
332
+ 20583.0s 332 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
333
+ 20585.0s 333 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
334
+ 20585.0s 334 warnings.warn('Was asked to gather along dimension 0, but all '
335
+ 20824.6s 335 Translated: We're excellent doctors, and so is he, so the operation will surely succeed.
336
+ 20918.9s 336 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
337
+ 20918.9s 337 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
338
+ 20920.8s 338 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
339
+ 20920.8s 339 warnings.warn('Was asked to gather along dimension 0, but all '
340
+ 21254.3s 340 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
341
+ 21254.3s 341 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
342
+ 21256.2s 342 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
343
+ 21256.2s 343 warnings.warn('Was asked to gather along dimension 0, but all '
344
+ 21496.0s 344 Translated: We're excellent doctors, and so is he, so the surgery will work.
345
+ 21589.8s 345 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
346
+ 21589.8s 346 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
347
+ 21591.7s 347 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
348
+ 21591.7s 348 warnings.warn('Was asked to gather along dimension 0, but all '
349
+ 21925.1s 349 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
350
+ 21925.1s 350 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
351
+ 21927.1s 351 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
352
+ 21927.1s 352 warnings.warn('Was asked to gather along dimension 0, but all '
353
+ 22166.0s 353 Translated: We're brilliant doctors, and so is he, so the operation will work.
354
+ 22260.3s 354 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
355
+ 22260.3s 355 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
356
+ 22262.3s 356 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
357
+ 22262.3s 357 warnings.warn('Was asked to gather along dimension 0, but all '
358
+ 22595.4s 358 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
359
+ 22595.4s 359 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
360
+ 22597.4s 360 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
361
+ 22597.4s 361 warnings.warn('Was asked to gather along dimension 0, but all '
362
+ 22836.5s 362 Translated: We were excellent doctors, and so was he, so the surgery was going to work.
363
+ 22930.9s 363 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
364
+ 22930.9s 364 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
365
+ 22932.9s 365 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
366
+ 22932.9s 366 warnings.warn('Was asked to gather along dimension 0, but all '
367
+ 23266.3s 367 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
368
+ 23266.3s 368 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
369
+ 23268.2s 369 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
370
+ 23268.2s 370 warnings.warn('Was asked to gather along dimension 0, but all '
371
+ 23508.3s 371 Translated: We're very good doctors, and so is he, so the operation will definitely work.
372
+ 23602.6s 372 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
373
+ 23602.6s 373 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
374
+ 23604.5s 374 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
375
+ 23604.5s 375 warnings.warn('Was asked to gather along dimension 0, but all '
376
+ 23937.9s 376 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
377
+ 23937.9s 377 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
378
+ 23939.8s 378 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
379
+ 23939.8s 379 warnings.warn('Was asked to gather along dimension 0, but all '
380
+ 24179.4s 380 Translated: We are excellent doctors, and so is he, so the surgery will surely succeed.
381
+ 24273.4s 381 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
382
+ 24273.4s 382 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
383
+ 24275.3s 383 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
384
+ 24275.3s 384 warnings.warn('Was asked to gather along dimension 0, but all '
385
+ 24608.7s 385 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
386
+ 24608.7s 386 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
387
+ 24610.6s 387 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
388
+ 24610.6s 388 warnings.warn('Was asked to gather along dimension 0, but all '
389
+ 24850.4s 389 Translated: We're excellent doctors, and so is he, so the surgery is bound to be a success.
390
+ 24945.4s 390 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
391
+ 24945.4s 391 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
392
+ 24947.4s 392 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
393
+ 24947.4s 393 warnings.warn('Was asked to gather along dimension 0, but all '
394
+ 25281.8s 394 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
395
+ 25281.8s 395 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
396
+ 25283.7s 396 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
397
+ 25283.7s 397 warnings.warn('Was asked to gather along dimension 0, but all '
398
+ 25523.0s 398 Translated: We're excellent doctors, and so is he, so the surgery is going to work.
399
+ 25617.7s 399 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
400
+ 25617.7s 400 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
401
+ 25619.6s 401 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
402
+ 25619.6s 402 warnings.warn('Was asked to gather along dimension 0, but all '
403
+ 25953.7s 403 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
404
+ 25953.7s 404 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
405
+ 25955.6s 405 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
406
+ 25955.6s 406 warnings.warn('Was asked to gather along dimension 0, but all '
407
+ 26195.6s 407 Translated: We're excellent doctors, and so is he, so the surgery is bound to work.
408
+ 26289.6s 408 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
409
+ 26289.6s 409 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
410
+ 26291.5s 410 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
411
+ 26291.5s 411 warnings.warn('Was asked to gather along dimension 0, but all '
412
+ 26625.3s 412 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
413
+ 26625.3s 413 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
414
+ 26627.2s 414 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
415
+ 26627.2s 415 warnings.warn('Was asked to gather along dimension 0, but all '
416
+ 26867.6s 416 Translated: We were excellent doctors, and so was he, so the surgery was bound to succeed.
417
+ 26962.2s 417 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
418
+ 26962.2s 418 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
419
+ 26964.1s 419 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
420
+ 26964.1s 420 warnings.warn('Was asked to gather along dimension 0, but all '
421
+ 27298.3s 421 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
422
+ 27298.3s 422 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
423
+ 27300.2s 423 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
424
+ 27300.2s 424 warnings.warn('Was asked to gather along dimension 0, but all '
425
+ 27540.6s 425 Translated: We're excellent doctors, and so is he, so the surgery will work.
426
+ 27634.8s 426 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
427
+ 27634.8s 427 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
428
+ 27636.8s 428 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
429
+ 27636.8s 429 warnings.warn('Was asked to gather along dimension 0, but all '
430
+ 27971.2s 430 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
431
+ 27971.2s 431 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
432
+ 27973.1s 432 /opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
433
+ 27973.1s 433 warnings.warn('Was asked to gather along dimension 0, but all '
434
+ 28022.0s 434 Some non-default generation parameters are set in the model config. These should go into a GenerationConfig file (https://huggingface.co/docs/transformers/generation_strategies#save-a-custom-decoding-strategy-with-your-model) instead. This warning will be raised to an exception in v4.41.
435
+ 28022.0s 435 Non-default generation parameters: {'max_length': 512, 'num_beams': 6, 'bad_words_ids': [[53738]], 'forced_eos_token_id': 0}
436
+ 28029.5s 436 wandb: - 0.004 MB of 0.004 MB uploaded
437
+ 28029.5s 437 warn(
438
+ 28029.5s 438 [NbConvertApp] WARNING | Config option `kernel_spec_manager_class` not recognized by `NbConvertApp`.
439
+ 28029.6s 439 [NbConvertApp] Converting notebook __notebook__.ipynb to notebook
440
+ 28030.2s 440 [NbConvertApp] Writing 249158 bytes to __notebook__.ipynb
441
+ 28031.8s 441 /opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py:2930: FutureWarning: --Exporter.preprocessors=["nbconvert.preprocessors.ExtractOutputPreprocessor"] for containers is deprecated in traitlets 5.0. You can pass `--Exporter.preprocessors item` ... multiple times to add items to a list.
442
+ 28031.8s 442 warn(
443
+ 28031.8s 443 [NbConvertApp] WARNING | Config option `kernel_spec_manager_class` not recognized by `NbConvertApp`.
444
+ 28031.8s 444 [NbConvertApp] Converting notebook __notebook__.ipynb to html
445
+ 28032.8s 445 [NbConvertApp] Writing 503311 bytes to __results__.html
model/vi_en/Translation_vi_en_official/predict.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, Seq2SeqTrainer, Seq2SeqTrainingArguments, DataCollatorForSeq2Seq
3
+ import sacrebleu
4
+ from rouge_score import rouge_scorer
5
+ import numpy as np
6
+ import html
7
+ from datasets import Dataset
8
+ import pandas as pd
9
+
10
+ SRC = 'vi'
11
+ TRG = 'en'
12
+ KIND = 'official'
13
+
14
+ def load_file(file_path):
15
+ lang = []
16
+
17
+ with open(file_path, "r", encoding="utf-8") as file:
18
+ content_en = file.read()
19
+ lang += content_en.split('\n')
20
+ lang = [html.unescape(sent) for sent in lang]
21
+ return lang
22
+
23
+ #tải model:
24
+ name_model = f"NguyenManhAI/translation-{SRC}-{TRG}-{KIND}"
25
+ model = AutoModelForSeq2SeqLM.from_pretrained(name_model)
26
+ tokenizer = AutoTokenizer.from_pretrained(name_model)
27
+
28
+ list_test = dict()
29
+ list_test[SRC] = load_file(f"../data/test/{SRC}-2013.{SRC}")
30
+ list_test[TRG] = load_file(f"../data/test/{TRG}-2013.{TRG}")
31
+
32
+ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
33
+ def predict(model, input_sentence, tokenizer):
34
+ # Dịch một câu hoàn chỉnh
35
+ # Token hóa câu đầu vào
36
+ inputs = tokenizer(input_sentence, return_tensors="pt", padding=True, truncation=True).to(device)
37
+
38
+ # Sử dụng mô hình để dự đoán
39
+ with torch.no_grad():
40
+ outputs = model.generate(**inputs, max_new_tokens = 50)
41
+
42
+ # Giải mã đầu ra của mô hình
43
+ translated_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True)
44
+ return translated_sentence
45
+
46
+ if __name__ == "__main__":
47
+ sentence = {
48
+ 'en': "I'm a doctor and so he is",
49
+ 'vi': "Tôi là một bác sĩ và anh ấy cũng vậy."
50
+ }
51
+
52
+ pred = predict(model, sentence[SRC], tokenizer)
53
+ print(pred)
54
+
55
+ translation = {
56
+ 'inputs':[],
57
+ 'preds':[],
58
+ 'labels':[]
59
+ }
60
+
61
+ for i in range(len(list_test[SRC])):
62
+ translation['inputs'].append(list_test[SRC][i])
63
+ translation['preds'].append(predict(model, list_test[SRC][i], tokenizer))
64
+ translation['labels'].append(list_test[TRG][i])
65
+
66
+ # Tính BLEU
67
+ bleu = sacrebleu.corpus_bleu(translation['preds'], [translation['labels']])
68
+ # Tính TER
69
+ ter = sacrebleu.corpus_ter(translation['preds'], [translation['labels']])
70
+ # Tính CHRF
71
+ chrf = sacrebleu.corpus_chrf(translation['preds'], [translation['labels']])
72
+
73
+ # Tính ROUGE
74
+ scorer = rouge_scorer.RougeScorer(['rouge1', 'rougeL'], use_stemmer=True)
75
+ rouge1_scores = []
76
+ rougeL_scores = []
77
+ for pred, label in zip(translation['preds'], translation['labels']):
78
+ scores = scorer.score(pred, label)
79
+ rouge1_scores.append(scores['rouge1'].fmeasure)
80
+ rougeL_scores.append(scores['rougeL'].fmeasure)
81
+
82
+ avg_rouge1 = sum(rouge1_scores) / len(rouge1_scores)
83
+ avg_rougeL = sum(rougeL_scores) / len(rougeL_scores)
84
+
85
+ metric_str = f"bleu\tter\tchrf\trouge1\trougeL\n{bleu.score}\t{ter.score}\t{chrf.score}\t{avg_rouge1}\t{avg_rougeL}"
86
+
87
+ f = open('final-result\metric.txt', 'w', encoding='utf-8')
88
+ f.write(metric_str)
89
+ f.close()
90
+
91
+ pd.DataFrame(translation).to_csv('final-result/translation.csv', index=False)
92
+
93
+ print("Lưu thành công")
model/vi_en/Translation_vi_en_official/result/eval-bleu.png ADDED
model/vi_en/Translation_vi_en_official/result/eval-loss.png ADDED
model/vi_en/Translation_vi_en_official/result/eval-rouge1.png ADDED