rajbhirud commited on
Commit
c2db4b6
·
verified ·
1 Parent(s): 9ab9a40

Upload WiDS_2023_LT.ipynb

Browse files
Files changed (1) hide show
  1. WiDS_2023_LT.ipynb +1840 -0
WiDS_2023_LT.ipynb ADDED
@@ -0,0 +1,1840 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nbformat": 4,
3
+ "nbformat_minor": 0,
4
+ "metadata": {
5
+ "colab": {
6
+ "provenance": [],
7
+ "gpuType": "T4"
8
+ },
9
+ "kernelspec": {
10
+ "name": "python3",
11
+ "display_name": "Python 3"
12
+ },
13
+ "language_info": {
14
+ "name": "python"
15
+ },
16
+ "accelerator": "GPU",
17
+ "widgets": {
18
+ "application/vnd.jupyter.widget-state+json": {
19
+ "8c1c7e4a6b8f47149ddca02e551f48a4": {
20
+ "model_module": "@jupyter-widgets/controls",
21
+ "model_name": "VBoxModel",
22
+ "model_module_version": "1.5.0",
23
+ "state": {
24
+ "_dom_classes": [],
25
+ "_model_module": "@jupyter-widgets/controls",
26
+ "_model_module_version": "1.5.0",
27
+ "_model_name": "VBoxModel",
28
+ "_view_count": null,
29
+ "_view_module": "@jupyter-widgets/controls",
30
+ "_view_module_version": "1.5.0",
31
+ "_view_name": "VBoxView",
32
+ "box_style": "",
33
+ "children": [
34
+ "IPY_MODEL_c2463a94b1fb44fa8196e7b61636c3b7",
35
+ "IPY_MODEL_3040b325f55949fdbdc4caf75e9cd618",
36
+ "IPY_MODEL_d9de6537b056464baa3dde45e81bbd72",
37
+ "IPY_MODEL_dc8c33db5e814578a4aa9355132e132a"
38
+ ],
39
+ "layout": "IPY_MODEL_022ab2bdb55944858b48891baa414d3c"
40
+ }
41
+ },
42
+ "cdbbba5c25e64371a6678a34e1120dc5": {
43
+ "model_module": "@jupyter-widgets/controls",
44
+ "model_name": "HTMLModel",
45
+ "model_module_version": "1.5.0",
46
+ "state": {
47
+ "_dom_classes": [],
48
+ "_model_module": "@jupyter-widgets/controls",
49
+ "_model_module_version": "1.5.0",
50
+ "_model_name": "HTMLModel",
51
+ "_view_count": null,
52
+ "_view_module": "@jupyter-widgets/controls",
53
+ "_view_module_version": "1.5.0",
54
+ "_view_name": "HTMLView",
55
+ "description": "",
56
+ "description_tooltip": null,
57
+ "layout": "IPY_MODEL_5b364ad09e3d4158a728284f583616b3",
58
+ "placeholder": "​",
59
+ "style": "IPY_MODEL_3e894d7c8a3545c3886c340328d289a2",
60
+ "value": "<center> <img\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.svg\nalt='Hugging Face'> <br> Copy a token from <a\nhref=\"https://huggingface.co/settings/tokens\" target=\"_blank\">your Hugging Face\ntokens page</a> and paste it below. <br> Immediately click login after copying\nyour token or it might be stored in plain text in this notebook file. </center>"
61
+ }
62
+ },
63
+ "70a2cd0297a6456f8a1913c3037a08cd": {
64
+ "model_module": "@jupyter-widgets/controls",
65
+ "model_name": "PasswordModel",
66
+ "model_module_version": "1.5.0",
67
+ "state": {
68
+ "_dom_classes": [],
69
+ "_model_module": "@jupyter-widgets/controls",
70
+ "_model_module_version": "1.5.0",
71
+ "_model_name": "PasswordModel",
72
+ "_view_count": null,
73
+ "_view_module": "@jupyter-widgets/controls",
74
+ "_view_module_version": "1.5.0",
75
+ "_view_name": "PasswordView",
76
+ "continuous_update": true,
77
+ "description": "Token:",
78
+ "description_tooltip": null,
79
+ "disabled": false,
80
+ "layout": "IPY_MODEL_f1b49e3bd1354e24bc911b2d2c7cfc7d",
81
+ "placeholder": "​",
82
+ "style": "IPY_MODEL_0c0fa6b93d144ddb8b9a4084dbaee2a4",
83
+ "value": ""
84
+ }
85
+ },
86
+ "fe8a530f6c91441fb7f48b77e5e673fa": {
87
+ "model_module": "@jupyter-widgets/controls",
88
+ "model_name": "CheckboxModel",
89
+ "model_module_version": "1.5.0",
90
+ "state": {
91
+ "_dom_classes": [],
92
+ "_model_module": "@jupyter-widgets/controls",
93
+ "_model_module_version": "1.5.0",
94
+ "_model_name": "CheckboxModel",
95
+ "_view_count": null,
96
+ "_view_module": "@jupyter-widgets/controls",
97
+ "_view_module_version": "1.5.0",
98
+ "_view_name": "CheckboxView",
99
+ "description": "Add token as git credential?",
100
+ "description_tooltip": null,
101
+ "disabled": false,
102
+ "indent": true,
103
+ "layout": "IPY_MODEL_f8bf8d132d774ab89cf258a7027b3557",
104
+ "style": "IPY_MODEL_5d043f830b7f4981b0597136f1e530ed",
105
+ "value": true
106
+ }
107
+ },
108
+ "9b84de3ec55a4035bf61621f80b0c374": {
109
+ "model_module": "@jupyter-widgets/controls",
110
+ "model_name": "ButtonModel",
111
+ "model_module_version": "1.5.0",
112
+ "state": {
113
+ "_dom_classes": [],
114
+ "_model_module": "@jupyter-widgets/controls",
115
+ "_model_module_version": "1.5.0",
116
+ "_model_name": "ButtonModel",
117
+ "_view_count": null,
118
+ "_view_module": "@jupyter-widgets/controls",
119
+ "_view_module_version": "1.5.0",
120
+ "_view_name": "ButtonView",
121
+ "button_style": "",
122
+ "description": "Login",
123
+ "disabled": false,
124
+ "icon": "",
125
+ "layout": "IPY_MODEL_3f1f2f9baab74de890b2213d4846611d",
126
+ "style": "IPY_MODEL_f3f7d114085d477692c4933876b8b5cc",
127
+ "tooltip": ""
128
+ }
129
+ },
130
+ "0f044626ebca4e21b8e05a45dae2341d": {
131
+ "model_module": "@jupyter-widgets/controls",
132
+ "model_name": "HTMLModel",
133
+ "model_module_version": "1.5.0",
134
+ "state": {
135
+ "_dom_classes": [],
136
+ "_model_module": "@jupyter-widgets/controls",
137
+ "_model_module_version": "1.5.0",
138
+ "_model_name": "HTMLModel",
139
+ "_view_count": null,
140
+ "_view_module": "@jupyter-widgets/controls",
141
+ "_view_module_version": "1.5.0",
142
+ "_view_name": "HTMLView",
143
+ "description": "",
144
+ "description_tooltip": null,
145
+ "layout": "IPY_MODEL_a2ceb52d59634de6bf64f41b6f3da3a4",
146
+ "placeholder": "​",
147
+ "style": "IPY_MODEL_60dc766ea8734e3baa5df22506d8fcf6",
148
+ "value": "\n<b>Pro Tip:</b> If you don't already have one, you can create a dedicated\n'notebooks' token with 'write' access, that you can then easily reuse for all\nnotebooks. </center>"
149
+ }
150
+ },
151
+ "022ab2bdb55944858b48891baa414d3c": {
152
+ "model_module": "@jupyter-widgets/base",
153
+ "model_name": "LayoutModel",
154
+ "model_module_version": "1.2.0",
155
+ "state": {
156
+ "_model_module": "@jupyter-widgets/base",
157
+ "_model_module_version": "1.2.0",
158
+ "_model_name": "LayoutModel",
159
+ "_view_count": null,
160
+ "_view_module": "@jupyter-widgets/base",
161
+ "_view_module_version": "1.2.0",
162
+ "_view_name": "LayoutView",
163
+ "align_content": null,
164
+ "align_items": "center",
165
+ "align_self": null,
166
+ "border": null,
167
+ "bottom": null,
168
+ "display": "flex",
169
+ "flex": null,
170
+ "flex_flow": "column",
171
+ "grid_area": null,
172
+ "grid_auto_columns": null,
173
+ "grid_auto_flow": null,
174
+ "grid_auto_rows": null,
175
+ "grid_column": null,
176
+ "grid_gap": null,
177
+ "grid_row": null,
178
+ "grid_template_areas": null,
179
+ "grid_template_columns": null,
180
+ "grid_template_rows": null,
181
+ "height": null,
182
+ "justify_content": null,
183
+ "justify_items": null,
184
+ "left": null,
185
+ "margin": null,
186
+ "max_height": null,
187
+ "max_width": null,
188
+ "min_height": null,
189
+ "min_width": null,
190
+ "object_fit": null,
191
+ "object_position": null,
192
+ "order": null,
193
+ "overflow": null,
194
+ "overflow_x": null,
195
+ "overflow_y": null,
196
+ "padding": null,
197
+ "right": null,
198
+ "top": null,
199
+ "visibility": null,
200
+ "width": "50%"
201
+ }
202
+ },
203
+ "5b364ad09e3d4158a728284f583616b3": {
204
+ "model_module": "@jupyter-widgets/base",
205
+ "model_name": "LayoutModel",
206
+ "model_module_version": "1.2.0",
207
+ "state": {
208
+ "_model_module": "@jupyter-widgets/base",
209
+ "_model_module_version": "1.2.0",
210
+ "_model_name": "LayoutModel",
211
+ "_view_count": null,
212
+ "_view_module": "@jupyter-widgets/base",
213
+ "_view_module_version": "1.2.0",
214
+ "_view_name": "LayoutView",
215
+ "align_content": null,
216
+ "align_items": null,
217
+ "align_self": null,
218
+ "border": null,
219
+ "bottom": null,
220
+ "display": null,
221
+ "flex": null,
222
+ "flex_flow": null,
223
+ "grid_area": null,
224
+ "grid_auto_columns": null,
225
+ "grid_auto_flow": null,
226
+ "grid_auto_rows": null,
227
+ "grid_column": null,
228
+ "grid_gap": null,
229
+ "grid_row": null,
230
+ "grid_template_areas": null,
231
+ "grid_template_columns": null,
232
+ "grid_template_rows": null,
233
+ "height": null,
234
+ "justify_content": null,
235
+ "justify_items": null,
236
+ "left": null,
237
+ "margin": null,
238
+ "max_height": null,
239
+ "max_width": null,
240
+ "min_height": null,
241
+ "min_width": null,
242
+ "object_fit": null,
243
+ "object_position": null,
244
+ "order": null,
245
+ "overflow": null,
246
+ "overflow_x": null,
247
+ "overflow_y": null,
248
+ "padding": null,
249
+ "right": null,
250
+ "top": null,
251
+ "visibility": null,
252
+ "width": null
253
+ }
254
+ },
255
+ "3e894d7c8a3545c3886c340328d289a2": {
256
+ "model_module": "@jupyter-widgets/controls",
257
+ "model_name": "DescriptionStyleModel",
258
+ "model_module_version": "1.5.0",
259
+ "state": {
260
+ "_model_module": "@jupyter-widgets/controls",
261
+ "_model_module_version": "1.5.0",
262
+ "_model_name": "DescriptionStyleModel",
263
+ "_view_count": null,
264
+ "_view_module": "@jupyter-widgets/base",
265
+ "_view_module_version": "1.2.0",
266
+ "_view_name": "StyleView",
267
+ "description_width": ""
268
+ }
269
+ },
270
+ "f1b49e3bd1354e24bc911b2d2c7cfc7d": {
271
+ "model_module": "@jupyter-widgets/base",
272
+ "model_name": "LayoutModel",
273
+ "model_module_version": "1.2.0",
274
+ "state": {
275
+ "_model_module": "@jupyter-widgets/base",
276
+ "_model_module_version": "1.2.0",
277
+ "_model_name": "LayoutModel",
278
+ "_view_count": null,
279
+ "_view_module": "@jupyter-widgets/base",
280
+ "_view_module_version": "1.2.0",
281
+ "_view_name": "LayoutView",
282
+ "align_content": null,
283
+ "align_items": null,
284
+ "align_self": null,
285
+ "border": null,
286
+ "bottom": null,
287
+ "display": null,
288
+ "flex": null,
289
+ "flex_flow": null,
290
+ "grid_area": null,
291
+ "grid_auto_columns": null,
292
+ "grid_auto_flow": null,
293
+ "grid_auto_rows": null,
294
+ "grid_column": null,
295
+ "grid_gap": null,
296
+ "grid_row": null,
297
+ "grid_template_areas": null,
298
+ "grid_template_columns": null,
299
+ "grid_template_rows": null,
300
+ "height": null,
301
+ "justify_content": null,
302
+ "justify_items": null,
303
+ "left": null,
304
+ "margin": null,
305
+ "max_height": null,
306
+ "max_width": null,
307
+ "min_height": null,
308
+ "min_width": null,
309
+ "object_fit": null,
310
+ "object_position": null,
311
+ "order": null,
312
+ "overflow": null,
313
+ "overflow_x": null,
314
+ "overflow_y": null,
315
+ "padding": null,
316
+ "right": null,
317
+ "top": null,
318
+ "visibility": null,
319
+ "width": null
320
+ }
321
+ },
322
+ "0c0fa6b93d144ddb8b9a4084dbaee2a4": {
323
+ "model_module": "@jupyter-widgets/controls",
324
+ "model_name": "DescriptionStyleModel",
325
+ "model_module_version": "1.5.0",
326
+ "state": {
327
+ "_model_module": "@jupyter-widgets/controls",
328
+ "_model_module_version": "1.5.0",
329
+ "_model_name": "DescriptionStyleModel",
330
+ "_view_count": null,
331
+ "_view_module": "@jupyter-widgets/base",
332
+ "_view_module_version": "1.2.0",
333
+ "_view_name": "StyleView",
334
+ "description_width": ""
335
+ }
336
+ },
337
+ "f8bf8d132d774ab89cf258a7027b3557": {
338
+ "model_module": "@jupyter-widgets/base",
339
+ "model_name": "LayoutModel",
340
+ "model_module_version": "1.2.0",
341
+ "state": {
342
+ "_model_module": "@jupyter-widgets/base",
343
+ "_model_module_version": "1.2.0",
344
+ "_model_name": "LayoutModel",
345
+ "_view_count": null,
346
+ "_view_module": "@jupyter-widgets/base",
347
+ "_view_module_version": "1.2.0",
348
+ "_view_name": "LayoutView",
349
+ "align_content": null,
350
+ "align_items": null,
351
+ "align_self": null,
352
+ "border": null,
353
+ "bottom": null,
354
+ "display": null,
355
+ "flex": null,
356
+ "flex_flow": null,
357
+ "grid_area": null,
358
+ "grid_auto_columns": null,
359
+ "grid_auto_flow": null,
360
+ "grid_auto_rows": null,
361
+ "grid_column": null,
362
+ "grid_gap": null,
363
+ "grid_row": null,
364
+ "grid_template_areas": null,
365
+ "grid_template_columns": null,
366
+ "grid_template_rows": null,
367
+ "height": null,
368
+ "justify_content": null,
369
+ "justify_items": null,
370
+ "left": null,
371
+ "margin": null,
372
+ "max_height": null,
373
+ "max_width": null,
374
+ "min_height": null,
375
+ "min_width": null,
376
+ "object_fit": null,
377
+ "object_position": null,
378
+ "order": null,
379
+ "overflow": null,
380
+ "overflow_x": null,
381
+ "overflow_y": null,
382
+ "padding": null,
383
+ "right": null,
384
+ "top": null,
385
+ "visibility": null,
386
+ "width": null
387
+ }
388
+ },
389
+ "5d043f830b7f4981b0597136f1e530ed": {
390
+ "model_module": "@jupyter-widgets/controls",
391
+ "model_name": "DescriptionStyleModel",
392
+ "model_module_version": "1.5.0",
393
+ "state": {
394
+ "_model_module": "@jupyter-widgets/controls",
395
+ "_model_module_version": "1.5.0",
396
+ "_model_name": "DescriptionStyleModel",
397
+ "_view_count": null,
398
+ "_view_module": "@jupyter-widgets/base",
399
+ "_view_module_version": "1.2.0",
400
+ "_view_name": "StyleView",
401
+ "description_width": ""
402
+ }
403
+ },
404
+ "3f1f2f9baab74de890b2213d4846611d": {
405
+ "model_module": "@jupyter-widgets/base",
406
+ "model_name": "LayoutModel",
407
+ "model_module_version": "1.2.0",
408
+ "state": {
409
+ "_model_module": "@jupyter-widgets/base",
410
+ "_model_module_version": "1.2.0",
411
+ "_model_name": "LayoutModel",
412
+ "_view_count": null,
413
+ "_view_module": "@jupyter-widgets/base",
414
+ "_view_module_version": "1.2.0",
415
+ "_view_name": "LayoutView",
416
+ "align_content": null,
417
+ "align_items": null,
418
+ "align_self": null,
419
+ "border": null,
420
+ "bottom": null,
421
+ "display": null,
422
+ "flex": null,
423
+ "flex_flow": null,
424
+ "grid_area": null,
425
+ "grid_auto_columns": null,
426
+ "grid_auto_flow": null,
427
+ "grid_auto_rows": null,
428
+ "grid_column": null,
429
+ "grid_gap": null,
430
+ "grid_row": null,
431
+ "grid_template_areas": null,
432
+ "grid_template_columns": null,
433
+ "grid_template_rows": null,
434
+ "height": null,
435
+ "justify_content": null,
436
+ "justify_items": null,
437
+ "left": null,
438
+ "margin": null,
439
+ "max_height": null,
440
+ "max_width": null,
441
+ "min_height": null,
442
+ "min_width": null,
443
+ "object_fit": null,
444
+ "object_position": null,
445
+ "order": null,
446
+ "overflow": null,
447
+ "overflow_x": null,
448
+ "overflow_y": null,
449
+ "padding": null,
450
+ "right": null,
451
+ "top": null,
452
+ "visibility": null,
453
+ "width": null
454
+ }
455
+ },
456
+ "f3f7d114085d477692c4933876b8b5cc": {
457
+ "model_module": "@jupyter-widgets/controls",
458
+ "model_name": "ButtonStyleModel",
459
+ "model_module_version": "1.5.0",
460
+ "state": {
461
+ "_model_module": "@jupyter-widgets/controls",
462
+ "_model_module_version": "1.5.0",
463
+ "_model_name": "ButtonStyleModel",
464
+ "_view_count": null,
465
+ "_view_module": "@jupyter-widgets/base",
466
+ "_view_module_version": "1.2.0",
467
+ "_view_name": "StyleView",
468
+ "button_color": null,
469
+ "font_weight": ""
470
+ }
471
+ },
472
+ "a2ceb52d59634de6bf64f41b6f3da3a4": {
473
+ "model_module": "@jupyter-widgets/base",
474
+ "model_name": "LayoutModel",
475
+ "model_module_version": "1.2.0",
476
+ "state": {
477
+ "_model_module": "@jupyter-widgets/base",
478
+ "_model_module_version": "1.2.0",
479
+ "_model_name": "LayoutModel",
480
+ "_view_count": null,
481
+ "_view_module": "@jupyter-widgets/base",
482
+ "_view_module_version": "1.2.0",
483
+ "_view_name": "LayoutView",
484
+ "align_content": null,
485
+ "align_items": null,
486
+ "align_self": null,
487
+ "border": null,
488
+ "bottom": null,
489
+ "display": null,
490
+ "flex": null,
491
+ "flex_flow": null,
492
+ "grid_area": null,
493
+ "grid_auto_columns": null,
494
+ "grid_auto_flow": null,
495
+ "grid_auto_rows": null,
496
+ "grid_column": null,
497
+ "grid_gap": null,
498
+ "grid_row": null,
499
+ "grid_template_areas": null,
500
+ "grid_template_columns": null,
501
+ "grid_template_rows": null,
502
+ "height": null,
503
+ "justify_content": null,
504
+ "justify_items": null,
505
+ "left": null,
506
+ "margin": null,
507
+ "max_height": null,
508
+ "max_width": null,
509
+ "min_height": null,
510
+ "min_width": null,
511
+ "object_fit": null,
512
+ "object_position": null,
513
+ "order": null,
514
+ "overflow": null,
515
+ "overflow_x": null,
516
+ "overflow_y": null,
517
+ "padding": null,
518
+ "right": null,
519
+ "top": null,
520
+ "visibility": null,
521
+ "width": null
522
+ }
523
+ },
524
+ "60dc766ea8734e3baa5df22506d8fcf6": {
525
+ "model_module": "@jupyter-widgets/controls",
526
+ "model_name": "DescriptionStyleModel",
527
+ "model_module_version": "1.5.0",
528
+ "state": {
529
+ "_model_module": "@jupyter-widgets/controls",
530
+ "_model_module_version": "1.5.0",
531
+ "_model_name": "DescriptionStyleModel",
532
+ "_view_count": null,
533
+ "_view_module": "@jupyter-widgets/base",
534
+ "_view_module_version": "1.2.0",
535
+ "_view_name": "StyleView",
536
+ "description_width": ""
537
+ }
538
+ },
539
+ "ca18786f952c4f3cbdb34b9a4ae5692e": {
540
+ "model_module": "@jupyter-widgets/controls",
541
+ "model_name": "LabelModel",
542
+ "model_module_version": "1.5.0",
543
+ "state": {
544
+ "_dom_classes": [],
545
+ "_model_module": "@jupyter-widgets/controls",
546
+ "_model_module_version": "1.5.0",
547
+ "_model_name": "LabelModel",
548
+ "_view_count": null,
549
+ "_view_module": "@jupyter-widgets/controls",
550
+ "_view_module_version": "1.5.0",
551
+ "_view_name": "LabelView",
552
+ "description": "",
553
+ "description_tooltip": null,
554
+ "layout": "IPY_MODEL_2728eea9f200454d9dc5454385c963a2",
555
+ "placeholder": "​",
556
+ "style": "IPY_MODEL_109c14c8f5814ecb92f95409e349cfaf",
557
+ "value": "Connecting..."
558
+ }
559
+ },
560
+ "2728eea9f200454d9dc5454385c963a2": {
561
+ "model_module": "@jupyter-widgets/base",
562
+ "model_name": "LayoutModel",
563
+ "model_module_version": "1.2.0",
564
+ "state": {
565
+ "_model_module": "@jupyter-widgets/base",
566
+ "_model_module_version": "1.2.0",
567
+ "_model_name": "LayoutModel",
568
+ "_view_count": null,
569
+ "_view_module": "@jupyter-widgets/base",
570
+ "_view_module_version": "1.2.0",
571
+ "_view_name": "LayoutView",
572
+ "align_content": null,
573
+ "align_items": null,
574
+ "align_self": null,
575
+ "border": null,
576
+ "bottom": null,
577
+ "display": null,
578
+ "flex": null,
579
+ "flex_flow": null,
580
+ "grid_area": null,
581
+ "grid_auto_columns": null,
582
+ "grid_auto_flow": null,
583
+ "grid_auto_rows": null,
584
+ "grid_column": null,
585
+ "grid_gap": null,
586
+ "grid_row": null,
587
+ "grid_template_areas": null,
588
+ "grid_template_columns": null,
589
+ "grid_template_rows": null,
590
+ "height": null,
591
+ "justify_content": null,
592
+ "justify_items": null,
593
+ "left": null,
594
+ "margin": null,
595
+ "max_height": null,
596
+ "max_width": null,
597
+ "min_height": null,
598
+ "min_width": null,
599
+ "object_fit": null,
600
+ "object_position": null,
601
+ "order": null,
602
+ "overflow": null,
603
+ "overflow_x": null,
604
+ "overflow_y": null,
605
+ "padding": null,
606
+ "right": null,
607
+ "top": null,
608
+ "visibility": null,
609
+ "width": null
610
+ }
611
+ },
612
+ "109c14c8f5814ecb92f95409e349cfaf": {
613
+ "model_module": "@jupyter-widgets/controls",
614
+ "model_name": "DescriptionStyleModel",
615
+ "model_module_version": "1.5.0",
616
+ "state": {
617
+ "_model_module": "@jupyter-widgets/controls",
618
+ "_model_module_version": "1.5.0",
619
+ "_model_name": "DescriptionStyleModel",
620
+ "_view_count": null,
621
+ "_view_module": "@jupyter-widgets/base",
622
+ "_view_module_version": "1.2.0",
623
+ "_view_name": "StyleView",
624
+ "description_width": ""
625
+ }
626
+ },
627
+ "c2463a94b1fb44fa8196e7b61636c3b7": {
628
+ "model_module": "@jupyter-widgets/controls",
629
+ "model_name": "LabelModel",
630
+ "model_module_version": "1.5.0",
631
+ "state": {
632
+ "_dom_classes": [],
633
+ "_model_module": "@jupyter-widgets/controls",
634
+ "_model_module_version": "1.5.0",
635
+ "_model_name": "LabelModel",
636
+ "_view_count": null,
637
+ "_view_module": "@jupyter-widgets/controls",
638
+ "_view_module_version": "1.5.0",
639
+ "_view_name": "LabelView",
640
+ "description": "",
641
+ "description_tooltip": null,
642
+ "layout": "IPY_MODEL_973a3f8b019c47e5b96cdb867ec5bba2",
643
+ "placeholder": "​",
644
+ "style": "IPY_MODEL_d327dc625f514fb3977ac2949f092cb4",
645
+ "value": "Token is valid (permission: write)."
646
+ }
647
+ },
648
+ "3040b325f55949fdbdc4caf75e9cd618": {
649
+ "model_module": "@jupyter-widgets/controls",
650
+ "model_name": "LabelModel",
651
+ "model_module_version": "1.5.0",
652
+ "state": {
653
+ "_dom_classes": [],
654
+ "_model_module": "@jupyter-widgets/controls",
655
+ "_model_module_version": "1.5.0",
656
+ "_model_name": "LabelModel",
657
+ "_view_count": null,
658
+ "_view_module": "@jupyter-widgets/controls",
659
+ "_view_module_version": "1.5.0",
660
+ "_view_name": "LabelView",
661
+ "description": "",
662
+ "description_tooltip": null,
663
+ "layout": "IPY_MODEL_f147b05bc86e4aaabcac45e441ad23ea",
664
+ "placeholder": "​",
665
+ "style": "IPY_MODEL_4411d82338c244d8aa5a130356f61110",
666
+ "value": "Your token has been saved in your configured git credential helpers (store)."
667
+ }
668
+ },
669
+ "d9de6537b056464baa3dde45e81bbd72": {
670
+ "model_module": "@jupyter-widgets/controls",
671
+ "model_name": "LabelModel",
672
+ "model_module_version": "1.5.0",
673
+ "state": {
674
+ "_dom_classes": [],
675
+ "_model_module": "@jupyter-widgets/controls",
676
+ "_model_module_version": "1.5.0",
677
+ "_model_name": "LabelModel",
678
+ "_view_count": null,
679
+ "_view_module": "@jupyter-widgets/controls",
680
+ "_view_module_version": "1.5.0",
681
+ "_view_name": "LabelView",
682
+ "description": "",
683
+ "description_tooltip": null,
684
+ "layout": "IPY_MODEL_f6a31775093449928d7b6e5306ff0bc7",
685
+ "placeholder": "​",
686
+ "style": "IPY_MODEL_2ca22edaacc6426b886f554090b2c719",
687
+ "value": "Your token has been saved to /root/.cache/huggingface/token"
688
+ }
689
+ },
690
+ "dc8c33db5e814578a4aa9355132e132a": {
691
+ "model_module": "@jupyter-widgets/controls",
692
+ "model_name": "LabelModel",
693
+ "model_module_version": "1.5.0",
694
+ "state": {
695
+ "_dom_classes": [],
696
+ "_model_module": "@jupyter-widgets/controls",
697
+ "_model_module_version": "1.5.0",
698
+ "_model_name": "LabelModel",
699
+ "_view_count": null,
700
+ "_view_module": "@jupyter-widgets/controls",
701
+ "_view_module_version": "1.5.0",
702
+ "_view_name": "LabelView",
703
+ "description": "",
704
+ "description_tooltip": null,
705
+ "layout": "IPY_MODEL_626b5f225cee422da0de229fb9ac4622",
706
+ "placeholder": "​",
707
+ "style": "IPY_MODEL_8c87840632404771a42d21d251deae1e",
708
+ "value": "Login successful"
709
+ }
710
+ },
711
+ "973a3f8b019c47e5b96cdb867ec5bba2": {
712
+ "model_module": "@jupyter-widgets/base",
713
+ "model_name": "LayoutModel",
714
+ "model_module_version": "1.2.0",
715
+ "state": {
716
+ "_model_module": "@jupyter-widgets/base",
717
+ "_model_module_version": "1.2.0",
718
+ "_model_name": "LayoutModel",
719
+ "_view_count": null,
720
+ "_view_module": "@jupyter-widgets/base",
721
+ "_view_module_version": "1.2.0",
722
+ "_view_name": "LayoutView",
723
+ "align_content": null,
724
+ "align_items": null,
725
+ "align_self": null,
726
+ "border": null,
727
+ "bottom": null,
728
+ "display": null,
729
+ "flex": null,
730
+ "flex_flow": null,
731
+ "grid_area": null,
732
+ "grid_auto_columns": null,
733
+ "grid_auto_flow": null,
734
+ "grid_auto_rows": null,
735
+ "grid_column": null,
736
+ "grid_gap": null,
737
+ "grid_row": null,
738
+ "grid_template_areas": null,
739
+ "grid_template_columns": null,
740
+ "grid_template_rows": null,
741
+ "height": null,
742
+ "justify_content": null,
743
+ "justify_items": null,
744
+ "left": null,
745
+ "margin": null,
746
+ "max_height": null,
747
+ "max_width": null,
748
+ "min_height": null,
749
+ "min_width": null,
750
+ "object_fit": null,
751
+ "object_position": null,
752
+ "order": null,
753
+ "overflow": null,
754
+ "overflow_x": null,
755
+ "overflow_y": null,
756
+ "padding": null,
757
+ "right": null,
758
+ "top": null,
759
+ "visibility": null,
760
+ "width": null
761
+ }
762
+ },
763
+ "d327dc625f514fb3977ac2949f092cb4": {
764
+ "model_module": "@jupyter-widgets/controls",
765
+ "model_name": "DescriptionStyleModel",
766
+ "model_module_version": "1.5.0",
767
+ "state": {
768
+ "_model_module": "@jupyter-widgets/controls",
769
+ "_model_module_version": "1.5.0",
770
+ "_model_name": "DescriptionStyleModel",
771
+ "_view_count": null,
772
+ "_view_module": "@jupyter-widgets/base",
773
+ "_view_module_version": "1.2.0",
774
+ "_view_name": "StyleView",
775
+ "description_width": ""
776
+ }
777
+ },
778
+ "f147b05bc86e4aaabcac45e441ad23ea": {
779
+ "model_module": "@jupyter-widgets/base",
780
+ "model_name": "LayoutModel",
781
+ "model_module_version": "1.2.0",
782
+ "state": {
783
+ "_model_module": "@jupyter-widgets/base",
784
+ "_model_module_version": "1.2.0",
785
+ "_model_name": "LayoutModel",
786
+ "_view_count": null,
787
+ "_view_module": "@jupyter-widgets/base",
788
+ "_view_module_version": "1.2.0",
789
+ "_view_name": "LayoutView",
790
+ "align_content": null,
791
+ "align_items": null,
792
+ "align_self": null,
793
+ "border": null,
794
+ "bottom": null,
795
+ "display": null,
796
+ "flex": null,
797
+ "flex_flow": null,
798
+ "grid_area": null,
799
+ "grid_auto_columns": null,
800
+ "grid_auto_flow": null,
801
+ "grid_auto_rows": null,
802
+ "grid_column": null,
803
+ "grid_gap": null,
804
+ "grid_row": null,
805
+ "grid_template_areas": null,
806
+ "grid_template_columns": null,
807
+ "grid_template_rows": null,
808
+ "height": null,
809
+ "justify_content": null,
810
+ "justify_items": null,
811
+ "left": null,
812
+ "margin": null,
813
+ "max_height": null,
814
+ "max_width": null,
815
+ "min_height": null,
816
+ "min_width": null,
817
+ "object_fit": null,
818
+ "object_position": null,
819
+ "order": null,
820
+ "overflow": null,
821
+ "overflow_x": null,
822
+ "overflow_y": null,
823
+ "padding": null,
824
+ "right": null,
825
+ "top": null,
826
+ "visibility": null,
827
+ "width": null
828
+ }
829
+ },
830
+ "4411d82338c244d8aa5a130356f61110": {
831
+ "model_module": "@jupyter-widgets/controls",
832
+ "model_name": "DescriptionStyleModel",
833
+ "model_module_version": "1.5.0",
834
+ "state": {
835
+ "_model_module": "@jupyter-widgets/controls",
836
+ "_model_module_version": "1.5.0",
837
+ "_model_name": "DescriptionStyleModel",
838
+ "_view_count": null,
839
+ "_view_module": "@jupyter-widgets/base",
840
+ "_view_module_version": "1.2.0",
841
+ "_view_name": "StyleView",
842
+ "description_width": ""
843
+ }
844
+ },
845
+ "f6a31775093449928d7b6e5306ff0bc7": {
846
+ "model_module": "@jupyter-widgets/base",
847
+ "model_name": "LayoutModel",
848
+ "model_module_version": "1.2.0",
849
+ "state": {
850
+ "_model_module": "@jupyter-widgets/base",
851
+ "_model_module_version": "1.2.0",
852
+ "_model_name": "LayoutModel",
853
+ "_view_count": null,
854
+ "_view_module": "@jupyter-widgets/base",
855
+ "_view_module_version": "1.2.0",
856
+ "_view_name": "LayoutView",
857
+ "align_content": null,
858
+ "align_items": null,
859
+ "align_self": null,
860
+ "border": null,
861
+ "bottom": null,
862
+ "display": null,
863
+ "flex": null,
864
+ "flex_flow": null,
865
+ "grid_area": null,
866
+ "grid_auto_columns": null,
867
+ "grid_auto_flow": null,
868
+ "grid_auto_rows": null,
869
+ "grid_column": null,
870
+ "grid_gap": null,
871
+ "grid_row": null,
872
+ "grid_template_areas": null,
873
+ "grid_template_columns": null,
874
+ "grid_template_rows": null,
875
+ "height": null,
876
+ "justify_content": null,
877
+ "justify_items": null,
878
+ "left": null,
879
+ "margin": null,
880
+ "max_height": null,
881
+ "max_width": null,
882
+ "min_height": null,
883
+ "min_width": null,
884
+ "object_fit": null,
885
+ "object_position": null,
886
+ "order": null,
887
+ "overflow": null,
888
+ "overflow_x": null,
889
+ "overflow_y": null,
890
+ "padding": null,
891
+ "right": null,
892
+ "top": null,
893
+ "visibility": null,
894
+ "width": null
895
+ }
896
+ },
897
+ "2ca22edaacc6426b886f554090b2c719": {
898
+ "model_module": "@jupyter-widgets/controls",
899
+ "model_name": "DescriptionStyleModel",
900
+ "model_module_version": "1.5.0",
901
+ "state": {
902
+ "_model_module": "@jupyter-widgets/controls",
903
+ "_model_module_version": "1.5.0",
904
+ "_model_name": "DescriptionStyleModel",
905
+ "_view_count": null,
906
+ "_view_module": "@jupyter-widgets/base",
907
+ "_view_module_version": "1.2.0",
908
+ "_view_name": "StyleView",
909
+ "description_width": ""
910
+ }
911
+ },
912
+ "626b5f225cee422da0de229fb9ac4622": {
913
+ "model_module": "@jupyter-widgets/base",
914
+ "model_name": "LayoutModel",
915
+ "model_module_version": "1.2.0",
916
+ "state": {
917
+ "_model_module": "@jupyter-widgets/base",
918
+ "_model_module_version": "1.2.0",
919
+ "_model_name": "LayoutModel",
920
+ "_view_count": null,
921
+ "_view_module": "@jupyter-widgets/base",
922
+ "_view_module_version": "1.2.0",
923
+ "_view_name": "LayoutView",
924
+ "align_content": null,
925
+ "align_items": null,
926
+ "align_self": null,
927
+ "border": null,
928
+ "bottom": null,
929
+ "display": null,
930
+ "flex": null,
931
+ "flex_flow": null,
932
+ "grid_area": null,
933
+ "grid_auto_columns": null,
934
+ "grid_auto_flow": null,
935
+ "grid_auto_rows": null,
936
+ "grid_column": null,
937
+ "grid_gap": null,
938
+ "grid_row": null,
939
+ "grid_template_areas": null,
940
+ "grid_template_columns": null,
941
+ "grid_template_rows": null,
942
+ "height": null,
943
+ "justify_content": null,
944
+ "justify_items": null,
945
+ "left": null,
946
+ "margin": null,
947
+ "max_height": null,
948
+ "max_width": null,
949
+ "min_height": null,
950
+ "min_width": null,
951
+ "object_fit": null,
952
+ "object_position": null,
953
+ "order": null,
954
+ "overflow": null,
955
+ "overflow_x": null,
956
+ "overflow_y": null,
957
+ "padding": null,
958
+ "right": null,
959
+ "top": null,
960
+ "visibility": null,
961
+ "width": null
962
+ }
963
+ },
964
+ "8c87840632404771a42d21d251deae1e": {
965
+ "model_module": "@jupyter-widgets/controls",
966
+ "model_name": "DescriptionStyleModel",
967
+ "model_module_version": "1.5.0",
968
+ "state": {
969
+ "_model_module": "@jupyter-widgets/controls",
970
+ "_model_module_version": "1.5.0",
971
+ "_model_name": "DescriptionStyleModel",
972
+ "_view_count": null,
973
+ "_view_module": "@jupyter-widgets/base",
974
+ "_view_module_version": "1.2.0",
975
+ "_view_name": "StyleView",
976
+ "description_width": ""
977
+ }
978
+ }
979
+ }
980
+ }
981
+ },
982
+ "cells": [
983
+ {
984
+ "cell_type": "markdown",
985
+ "source": [
986
+ "# WiDS 2023: Language Translation Model\n",
987
+ "This Jupyter notebook contains the code for the language translation model using a pre-trained Transformer based Neural Networks and NLP from Hugging face 🤗. It includes steps for fine-tuning the model on a specific dataset, preprocessing the data, training, and evaluating the model, ultimately providing a user interactive interface for language translation using Gradio."
988
+ ],
989
+ "metadata": {
990
+ "id": "jd4hr9XpxEAT"
991
+ }
992
+ },
993
+ {
994
+ "cell_type": "markdown",
995
+ "source": [
996
+ "Initially, we establish a connection to the GPU to optimize the execution of our program, leveraging its capacity to efficiently process tasks involving substantial datasets."
997
+ ],
998
+ "metadata": {
999
+ "id": "Tn-rAGS7zIPo"
1000
+ }
1001
+ },
1002
+ {
1003
+ "cell_type": "code",
1004
+ "source": [
1005
+ "#checking whether GPU is working or not\n",
1006
+ "!nvidia-smi"
1007
+ ],
1008
+ "metadata": {
1009
+ "colab": {
1010
+ "base_uri": "https://localhost:8080/"
1011
+ },
1012
+ "id": "KrFSyiSTzGAu",
1013
+ "outputId": "6655d2e5-8c06-45df-9ebc-579726434678"
1014
+ },
1015
+ "execution_count": 1,
1016
+ "outputs": [
1017
+ {
1018
+ "output_type": "stream",
1019
+ "name": "stdout",
1020
+ "text": [
1021
+ "Sat Jan 13 08:47:46 2024 \n",
1022
+ "+---------------------------------------------------------------------------------------+\n",
1023
+ "| NVIDIA-SMI 535.104.05 Driver Version: 535.104.05 CUDA Version: 12.2 |\n",
1024
+ "|-----------------------------------------+----------------------+----------------------+\n",
1025
+ "| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
1026
+ "| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |\n",
1027
+ "| | | MIG M. |\n",
1028
+ "|=========================================+======================+======================|\n",
1029
+ "| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 |\n",
1030
+ "| N/A 74C P8 13W / 70W | 0MiB / 15360MiB | 0% Default |\n",
1031
+ "| | | N/A |\n",
1032
+ "+-----------------------------------------+----------------------+----------------------+\n",
1033
+ " \n",
1034
+ "+---------------------------------------------------------------------------------------+\n",
1035
+ "| Processes: |\n",
1036
+ "| GPU GI CI PID Type Process name GPU Memory |\n",
1037
+ "| ID ID Usage |\n",
1038
+ "|=======================================================================================|\n",
1039
+ "| No running processes found |\n",
1040
+ "+---------------------------------------------------------------------------------------+\n"
1041
+ ]
1042
+ }
1043
+ ]
1044
+ },
1045
+ {
1046
+ "cell_type": "code",
1047
+ "source": [
1048
+ "#installing all the necessary libraries\n",
1049
+ "! pip install -q transformers accelerate sentencepiece gradio datasets evaluate sacrebleu"
1050
+ ],
1051
+ "metadata": {
1052
+ "id": "1i5ye3v4zpOM"
1053
+ },
1054
+ "execution_count": 2,
1055
+ "outputs": []
1056
+ },
1057
+ {
1058
+ "cell_type": "markdown",
1059
+ "source": [
1060
+ "Importing all the necessary libaries and module."
1061
+ ],
1062
+ "metadata": {
1063
+ "id": "2QCou91X0DcV"
1064
+ }
1065
+ },
1066
+ {
1067
+ "cell_type": "code",
1068
+ "source": [
1069
+ "import evaluate\n",
1070
+ "import numpy as np\n",
1071
+ "from datasets import load_dataset\n",
1072
+ "from sklearn.model_selection import train_test_split\n",
1073
+ "from transformers import pipeline\n",
1074
+ "from transformers import AutoTokenizer\n",
1075
+ "from transformers import AutoModelForSeq2SeqLM\n",
1076
+ "from transformers import DataCollatorForSeq2Seq\n",
1077
+ "from transformers import Seq2SeqTrainingArguments\n",
1078
+ "from transformers import Seq2SeqTrainer\n",
1079
+ "from huggingface_hub import notebook_login"
1080
+ ],
1081
+ "metadata": {
1082
+ "id": "jI3MBl6R81Dq"
1083
+ },
1084
+ "execution_count": 3,
1085
+ "outputs": []
1086
+ },
1087
+ {
1088
+ "cell_type": "markdown",
1089
+ "source": [
1090
+ "We download the \"kde4\" dataset from Hugging Face, a curated dataset designed for language translation. It's essential to specify the two languages involved in the translation process when obtaining this dataset."
1091
+ ],
1092
+ "metadata": {
1093
+ "id": "AVnEuqQdXish"
1094
+ }
1095
+ },
1096
+ {
1097
+ "cell_type": "code",
1098
+ "source": [
1099
+ "raw_datasets = load_dataset(\"kde4\", lang1=\"en\", lang2=\"fr\")\n",
1100
+ "raw_datasets"
1101
+ ],
1102
+ "metadata": {
1103
+ "colab": {
1104
+ "base_uri": "https://localhost:8080/"
1105
+ },
1106
+ "id": "0bazUZj5zvr8",
1107
+ "outputId": "d94cbfac-9410-4e8f-9145-0245ee86f920"
1108
+ },
1109
+ "execution_count": 4,
1110
+ "outputs": [
1111
+ {
1112
+ "output_type": "stream",
1113
+ "name": "stderr",
1114
+ "text": [
1115
+ "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_token.py:88: UserWarning: \n",
1116
+ "The secret `HF_TOKEN` does not exist in your Colab secrets.\n",
1117
+ "To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.\n",
1118
+ "You will be able to reuse this secret in all of your notebooks.\n",
1119
+ "Please note that authentication is recommended but still optional to access public models or datasets.\n",
1120
+ " warnings.warn(\n",
1121
+ "/usr/local/lib/python3.10/dist-packages/datasets/load.py:1429: FutureWarning: The repository for kde4 contains custom code which must be executed to correctly load the dataset. You can inspect the repository content at https://hf.co/datasets/kde4\n",
1122
+ "You can avoid this message in future by passing the argument `trust_remote_code=True`.\n",
1123
+ "Passing `trust_remote_code=True` will be mandatory to load this dataset from the next major release of `datasets`.\n",
1124
+ " warnings.warn(\n"
1125
+ ]
1126
+ },
1127
+ {
1128
+ "output_type": "execute_result",
1129
+ "data": {
1130
+ "text/plain": [
1131
+ "DatasetDict({\n",
1132
+ " train: Dataset({\n",
1133
+ " features: ['id', 'translation'],\n",
1134
+ " num_rows: 210173\n",
1135
+ " })\n",
1136
+ "})"
1137
+ ]
1138
+ },
1139
+ "metadata": {},
1140
+ "execution_count": 4
1141
+ }
1142
+ ]
1143
+ },
1144
+ {
1145
+ "cell_type": "markdown",
1146
+ "source": [
1147
+ "The dataset initially includes only a training set, but for a comprehensive evaluation of our model's performance, we need both training and testing sets. To achieve this, we employ the train_test_split function, effectively partitioning the dataset into distinct training and testing subsets for subsequent model assessment."
1148
+ ],
1149
+ "metadata": {
1150
+ "id": "7lCOOlj_0zAD"
1151
+ }
1152
+ },
1153
+ {
1154
+ "cell_type": "code",
1155
+ "source": [
1156
+ "split_datasets= raw_datasets[\"train\"].train_test_split(test_size=0.2, seed=20)\n",
1157
+ "split_datasets"
1158
+ ],
1159
+ "metadata": {
1160
+ "colab": {
1161
+ "base_uri": "https://localhost:8080/"
1162
+ },
1163
+ "id": "qbrDvPe_0x5A",
1164
+ "outputId": "29166139-473f-4bc0-bc0c-8b39f36f6621"
1165
+ },
1166
+ "execution_count": 5,
1167
+ "outputs": [
1168
+ {
1169
+ "output_type": "execute_result",
1170
+ "data": {
1171
+ "text/plain": [
1172
+ "DatasetDict({\n",
1173
+ " train: Dataset({\n",
1174
+ " features: ['id', 'translation'],\n",
1175
+ " num_rows: 168138\n",
1176
+ " })\n",
1177
+ " test: Dataset({\n",
1178
+ " features: ['id', 'translation'],\n",
1179
+ " num_rows: 42035\n",
1180
+ " })\n",
1181
+ "})"
1182
+ ]
1183
+ },
1184
+ "metadata": {},
1185
+ "execution_count": 5
1186
+ }
1187
+ ]
1188
+ },
1189
+ {
1190
+ "cell_type": "code",
1191
+ "source": [
1192
+ "split_datasets[\"train\"][45][\"translation\"]"
1193
+ ],
1194
+ "metadata": {
1195
+ "colab": {
1196
+ "base_uri": "https://localhost:8080/"
1197
+ },
1198
+ "id": "5r2LDjjU1pAI",
1199
+ "outputId": "b2720a51-63b2-4595-d6df-0221ad52d4bf"
1200
+ },
1201
+ "execution_count": 6,
1202
+ "outputs": [
1203
+ {
1204
+ "output_type": "execute_result",
1205
+ "data": {
1206
+ "text/plain": [
1207
+ "{'en': 'If you choose the wrong settings here your articles could be unreadable or not sendable at all, so please be careful with these settings.',\n",
1208
+ " 'fr': 'Si vous choisissez ici les mauvais paramètres, vos articles peuvent devenir illisibles ou vous ne pourrez pas du tout les envoyer. Veuillez donc être prudent avec ces paramètres.'}"
1209
+ ]
1210
+ },
1211
+ "metadata": {},
1212
+ "execution_count": 6
1213
+ }
1214
+ ]
1215
+ },
1216
+ {
1217
+ "cell_type": "markdown",
1218
+ "source": [
1219
+ "We will utilize a pre-trained model available on HuggingFace, specifically the Helsinki-NLP/opus-mt-en-fr model. This model has been pre-trained to facilitate translation tasks from English to French, and we will leverage its capabilities for our language translation project."
1220
+ ],
1221
+ "metadata": {
1222
+ "id": "pD-XEIQ41v2I"
1223
+ }
1224
+ },
1225
+ {
1226
+ "cell_type": "code",
1227
+ "source": [
1228
+ "model=\"Helsinki-NLP/opus-mt-en-fr\"\n",
1229
+ "translator=pipeline(\"translation\", model=model)\n",
1230
+ "translator(\"If you choose the wrong settings here your articles could be unreadable or not sendable at all, so please be careful with these settings.\")"
1231
+ ],
1232
+ "metadata": {
1233
+ "colab": {
1234
+ "base_uri": "https://localhost:8080/"
1235
+ },
1236
+ "id": "5QM1qTcQ2CT4",
1237
+ "outputId": "1eac8925-afe8-45cd-f263-fc9c900829a0"
1238
+ },
1239
+ "execution_count": 7,
1240
+ "outputs": [
1241
+ {
1242
+ "output_type": "stream",
1243
+ "name": "stderr",
1244
+ "text": [
1245
+ "/usr/local/lib/python3.10/dist-packages/transformers/models/marian/tokenization_marian.py:197: UserWarning: Recommended: pip install sacremoses.\n",
1246
+ " warnings.warn(\"Recommended: pip install sacremoses.\")\n"
1247
+ ]
1248
+ },
1249
+ {
1250
+ "output_type": "execute_result",
1251
+ "data": {
1252
+ "text/plain": [
1253
+ "[{'translation_text': \"Si vous choisissez les mauvais paramètres ici, vos articles pourraient être illisibles ou ne pas être envoyés du tout, alors s'il vous plaît soyez prudent avec ces paramètres.\"}]"
1254
+ ]
1255
+ },
1256
+ "metadata": {},
1257
+ "execution_count": 7
1258
+ }
1259
+ ]
1260
+ },
1261
+ {
1262
+ "cell_type": "markdown",
1263
+ "source": [
1264
+ "The initial results from the pre-trained model demonstrate reasonably accurate translations. Further refinement through fine-tuning is expected to enhance the translation quality even more.\n",
1265
+ "\n",
1266
+ "Next, we employ the AutoTokenizer to apply the same tokenization scheme used in the pre-trained model to process the dataset."
1267
+ ],
1268
+ "metadata": {
1269
+ "id": "fxdJGwXv2WXt"
1270
+ }
1271
+ },
1272
+ {
1273
+ "cell_type": "code",
1274
+ "source": [
1275
+ "tokenizer=AutoTokenizer.from_pretrained(model, return_tensors=\"pt\")"
1276
+ ],
1277
+ "metadata": {
1278
+ "id": "2mh8dVZU2F_f"
1279
+ },
1280
+ "execution_count": 8,
1281
+ "outputs": []
1282
+ },
1283
+ {
1284
+ "cell_type": "code",
1285
+ "source": [
1286
+ "def pre_processtext(text):\n",
1287
+ " inputs=[sample['en'] for sample in text['translation']]\n",
1288
+ " output=[sample['fr'] for sample in text['translation']]\n",
1289
+ " tokenized_text=tokenizer(inputs, text_target=output, max_length=128, truncation=True) #(text_target because if not done it will tokenize the french sentence according to english and so the labels will then not be correct)\n",
1290
+ " return tokenized_text"
1291
+ ],
1292
+ "metadata": {
1293
+ "id": "UTXFIklN2fNN"
1294
+ },
1295
+ "execution_count": 9,
1296
+ "outputs": []
1297
+ },
1298
+ {
1299
+ "cell_type": "code",
1300
+ "source": [
1301
+ "tokenized_datasets=split_datasets.map(\n",
1302
+ " pre_processtext,\n",
1303
+ " batched=True,\n",
1304
+ " remove_columns=split_datasets[\"train\"].column_names #(to remove extra columns)\n",
1305
+ ")"
1306
+ ],
1307
+ "metadata": {
1308
+ "id": "9GZsxyhl2hUV"
1309
+ },
1310
+ "execution_count": 10,
1311
+ "outputs": []
1312
+ },
1313
+ {
1314
+ "cell_type": "markdown",
1315
+ "source": [
1316
+ "Following preprocessing, the next step involves selecting a model for training, and in this case, the choice is the AutoModelForSeq2SeqLM."
1317
+ ],
1318
+ "metadata": {
1319
+ "id": "jVfmONpU2s2B"
1320
+ }
1321
+ },
1322
+ {
1323
+ "cell_type": "code",
1324
+ "source": [
1325
+ "model_1= AutoModelForSeq2SeqLM.from_pretrained(model)"
1326
+ ],
1327
+ "metadata": {
1328
+ "id": "SjRCrAz62k6x"
1329
+ },
1330
+ "execution_count": 11,
1331
+ "outputs": []
1332
+ },
1333
+ {
1334
+ "cell_type": "markdown",
1335
+ "source": [
1336
+ "The data collator plays a crucial role, facilitating dynamic padding, appending -100 to short sentences for length matching, and incorporating a start-of-sentence token, visible in decoder_input_ids."
1337
+ ],
1338
+ "metadata": {
1339
+ "id": "gClhwDls2wzq"
1340
+ }
1341
+ },
1342
+ {
1343
+ "cell_type": "code",
1344
+ "source": [
1345
+ "data_collator=DataCollatorForSeq2Seq(tokenizer,model=model_1)"
1346
+ ],
1347
+ "metadata": {
1348
+ "id": "LwPGf4Xk25Ae"
1349
+ },
1350
+ "execution_count": 12,
1351
+ "outputs": []
1352
+ },
1353
+ {
1354
+ "cell_type": "code",
1355
+ "source": [
1356
+ "batch = data_collator([tokenized_datasets[\"train\"][i] for i in range(1,3)])\n",
1357
+ "print(batch.keys())\n",
1358
+ "print(batch['labels'])\n",
1359
+ "batch['decoder_input_ids']"
1360
+ ],
1361
+ "metadata": {
1362
+ "colab": {
1363
+ "base_uri": "https://localhost:8080/"
1364
+ },
1365
+ "id": "tw6WhfZ_27aY",
1366
+ "outputId": "44512578-ae13-435f-84a1-def8441b4e42"
1367
+ },
1368
+ "execution_count": 13,
1369
+ "outputs": [
1370
+ {
1371
+ "output_type": "stream",
1372
+ "name": "stdout",
1373
+ "text": [
1374
+ "dict_keys(['input_ids', 'attention_mask', 'labels', 'decoder_input_ids'])\n",
1375
+ "tensor([[25966, 19, 540, 8, 669, 33355, 24, 11106, 37, 583,\n",
1376
+ " 583, 9507, 10571, 3, 49, 19015, 3, 49, 1937, 74,\n",
1377
+ " 2635, 973, 529, 13518, 74, 102, 0],\n",
1378
+ " [14743, 301, 548, 0, -100, -100, -100, -100, -100, -100,\n",
1379
+ " -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,\n",
1380
+ " -100, -100, -100, -100, -100, -100, -100]])\n"
1381
+ ]
1382
+ },
1383
+ {
1384
+ "output_type": "execute_result",
1385
+ "data": {
1386
+ "text/plain": [
1387
+ "tensor([[59513, 25966, 19, 540, 8, 669, 33355, 24, 11106, 37,\n",
1388
+ " 583, 583, 9507, 10571, 3, 49, 19015, 3, 49, 1937,\n",
1389
+ " 74, 2635, 973, 529, 13518, 74, 102],\n",
1390
+ " [59513, 14743, 301, 548, 0, 59513, 59513, 59513, 59513, 59513,\n",
1391
+ " 59513, 59513, 59513, 59513, 59513, 59513, 59513, 59513, 59513, 59513,\n",
1392
+ " 59513, 59513, 59513, 59513, 59513, 59513, 59513]])"
1393
+ ]
1394
+ },
1395
+ "metadata": {},
1396
+ "execution_count": 13
1397
+ }
1398
+ ]
1399
+ },
1400
+ {
1401
+ "cell_type": "markdown",
1402
+ "source": [
1403
+ "To assess our model, we employ the sacrebleu score, which focuses on word matching between translations and references. This metric doesn't scrutinize grammatical correctness but penalizes repetitive words not present in the original translation."
1404
+ ],
1405
+ "metadata": {
1406
+ "id": "FRw8bbhb3Ed7"
1407
+ }
1408
+ },
1409
+ {
1410
+ "cell_type": "code",
1411
+ "source": [
1412
+ "metric_evaluate= evaluate.load(\"sacrebleu\")"
1413
+ ],
1414
+ "metadata": {
1415
+ "id": "ofoatdSx29pn"
1416
+ },
1417
+ "execution_count": 14,
1418
+ "outputs": []
1419
+ },
1420
+ {
1421
+ "cell_type": "code",
1422
+ "source": [
1423
+ "def compute_metrics(eval):\n",
1424
+ " preds, labels= eval\n",
1425
+ " if isinstance(preds, tuple): #if model returns more than the prediction logits\n",
1426
+ " preds=preds[0]\n",
1427
+ " decoded_preds= tokenizer.batch_decode(preds, skip_special_tokens=True)\n",
1428
+ "\n",
1429
+ " labels=np.where(labels != -100, labels,tokenizer.pad_token_id) #replacing -100 as we will not be able to decode them\n",
1430
+ " decoded_labels=tokenizer.batch_decode(labels, skip_special_tokens=True)\n",
1431
+ "\n",
1432
+ " decoded_preds=[pred.strip() for pred in decoded_preds]\n",
1433
+ " decoded_labels=[[label.strip()] for label in decoded_labels] #references should be list of list of sentences\n",
1434
+ "\n",
1435
+ " result=metric_evaluate.compute(predictions=decoded_preds, references=decoded_labels)\n",
1436
+ " return {\"bleu\": result[\"score\"]}"
1437
+ ],
1438
+ "metadata": {
1439
+ "id": "73eZuhyD3KSx"
1440
+ },
1441
+ "execution_count": 15,
1442
+ "outputs": []
1443
+ },
1444
+ {
1445
+ "cell_type": "markdown",
1446
+ "source": [
1447
+ "To preserve my model, I'll utilize the Hugging Face repository. Let's proceed by logging into the Hugging Face platform."
1448
+ ],
1449
+ "metadata": {
1450
+ "id": "Rjiji2Zh3Pd-"
1451
+ }
1452
+ },
1453
+ {
1454
+ "cell_type": "code",
1455
+ "source": [
1456
+ "notebook_login()"
1457
+ ],
1458
+ "metadata": {
1459
+ "colab": {
1460
+ "base_uri": "https://localhost:8080/",
1461
+ "height": 145,
1462
+ "referenced_widgets": [
1463
+ "8c1c7e4a6b8f47149ddca02e551f48a4",
1464
+ "cdbbba5c25e64371a6678a34e1120dc5",
1465
+ "70a2cd0297a6456f8a1913c3037a08cd",
1466
+ "fe8a530f6c91441fb7f48b77e5e673fa",
1467
+ "9b84de3ec55a4035bf61621f80b0c374",
1468
+ "0f044626ebca4e21b8e05a45dae2341d",
1469
+ "022ab2bdb55944858b48891baa414d3c",
1470
+ "5b364ad09e3d4158a728284f583616b3",
1471
+ "3e894d7c8a3545c3886c340328d289a2",
1472
+ "f1b49e3bd1354e24bc911b2d2c7cfc7d",
1473
+ "0c0fa6b93d144ddb8b9a4084dbaee2a4",
1474
+ "f8bf8d132d774ab89cf258a7027b3557",
1475
+ "5d043f830b7f4981b0597136f1e530ed",
1476
+ "3f1f2f9baab74de890b2213d4846611d",
1477
+ "f3f7d114085d477692c4933876b8b5cc",
1478
+ "a2ceb52d59634de6bf64f41b6f3da3a4",
1479
+ "60dc766ea8734e3baa5df22506d8fcf6",
1480
+ "ca18786f952c4f3cbdb34b9a4ae5692e",
1481
+ "2728eea9f200454d9dc5454385c963a2",
1482
+ "109c14c8f5814ecb92f95409e349cfaf",
1483
+ "c2463a94b1fb44fa8196e7b61636c3b7",
1484
+ "3040b325f55949fdbdc4caf75e9cd618",
1485
+ "d9de6537b056464baa3dde45e81bbd72",
1486
+ "dc8c33db5e814578a4aa9355132e132a",
1487
+ "973a3f8b019c47e5b96cdb867ec5bba2",
1488
+ "d327dc625f514fb3977ac2949f092cb4",
1489
+ "f147b05bc86e4aaabcac45e441ad23ea",
1490
+ "4411d82338c244d8aa5a130356f61110",
1491
+ "f6a31775093449928d7b6e5306ff0bc7",
1492
+ "2ca22edaacc6426b886f554090b2c719",
1493
+ "626b5f225cee422da0de229fb9ac4622",
1494
+ "8c87840632404771a42d21d251deae1e"
1495
+ ]
1496
+ },
1497
+ "id": "Rbk3-DTU3OuC",
1498
+ "outputId": "653cd2e8-4fb9-4495-9fe5-3d99673ac6cd"
1499
+ },
1500
+ "execution_count": 16,
1501
+ "outputs": [
1502
+ {
1503
+ "output_type": "display_data",
1504
+ "data": {
1505
+ "text/plain": [
1506
+ "VBox(children=(HTML(value='<center> <img\\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.sv…"
1507
+ ],
1508
+ "application/vnd.jupyter.widget-view+json": {
1509
+ "version_major": 2,
1510
+ "version_minor": 0,
1511
+ "model_id": "8c1c7e4a6b8f47149ddca02e551f48a4"
1512
+ }
1513
+ },
1514
+ "metadata": {}
1515
+ }
1516
+ ]
1517
+ },
1518
+ {
1519
+ "cell_type": "markdown",
1520
+ "source": [
1521
+ "To fine-tune and train our dataset using a pre-trained model, we'll leverage the Seq2SeqTrainingArguments and Seq2SeqTrainer, configuring the relevant parameters to ensure the model's effectiveness can be assessed."
1522
+ ],
1523
+ "metadata": {
1524
+ "id": "HbOell3-3sas"
1525
+ }
1526
+ },
1527
+ {
1528
+ "cell_type": "code",
1529
+ "source": [
1530
+ "arg= Seq2SeqTrainingArguments(\n",
1531
+ " f\"eng-to-fra-model\",\n",
1532
+ " evaluation_strategy=\"no\",\n",
1533
+ " save_strategy=\"epoch\",\n",
1534
+ " learning_rate=3e-5,\n",
1535
+ " per_device_train_batch_size=32,\n",
1536
+ " per_device_eval_batch_size=64,\n",
1537
+ " weight_decay=0.01,\n",
1538
+ " save_total_limit=3,\n",
1539
+ " num_train_epochs=3,\n",
1540
+ " predict_with_generate=True,\n",
1541
+ " fp16=True,\n",
1542
+ " push_to_hub=True #(for saving my model onto huggingface repository)\n",
1543
+ ")"
1544
+ ],
1545
+ "metadata": {
1546
+ "id": "q2TnvOTs3YFi"
1547
+ },
1548
+ "execution_count": 17,
1549
+ "outputs": []
1550
+ },
1551
+ {
1552
+ "cell_type": "code",
1553
+ "source": [
1554
+ "trainer = Seq2SeqTrainer(\n",
1555
+ " model=model_1,\n",
1556
+ " args=arg,\n",
1557
+ " train_dataset=tokenized_datasets[\"train\"],\n",
1558
+ " eval_dataset=tokenized_datasets[\"test\"],\n",
1559
+ " data_collator=data_collator,\n",
1560
+ " tokenizer=tokenizer,\n",
1561
+ " compute_metrics=compute_metrics\n",
1562
+ ")"
1563
+ ],
1564
+ "metadata": {
1565
+ "id": "ZfCpHJbf3wer"
1566
+ },
1567
+ "execution_count": 18,
1568
+ "outputs": []
1569
+ },
1570
+ {
1571
+ "cell_type": "code",
1572
+ "source": [
1573
+ "#training starts form here\n",
1574
+ "trainer.train()"
1575
+ ],
1576
+ "metadata": {
1577
+ "id": "uWTZe5Lg3zZQ",
1578
+ "colab": {
1579
+ "base_uri": "https://localhost:8080/",
1580
+ "height": 1000
1581
+ },
1582
+ "outputId": "15725474-e67d-4517-9993-bcf181026b11"
1583
+ },
1584
+ "execution_count": 19,
1585
+ "outputs": [
1586
+ {
1587
+ "output_type": "display_data",
1588
+ "data": {
1589
+ "text/plain": [
1590
+ "<IPython.core.display.HTML object>"
1591
+ ],
1592
+ "text/html": [
1593
+ "\n",
1594
+ " <div>\n",
1595
+ " \n",
1596
+ " <progress value='15765' max='15765' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
1597
+ " [15765/15765 49:09, Epoch 3/3]\n",
1598
+ " </div>\n",
1599
+ " <table border=\"1\" class=\"dataframe\">\n",
1600
+ " <thead>\n",
1601
+ " <tr style=\"text-align: left;\">\n",
1602
+ " <th>Step</th>\n",
1603
+ " <th>Training Loss</th>\n",
1604
+ " </tr>\n",
1605
+ " </thead>\n",
1606
+ " <tbody>\n",
1607
+ " <tr>\n",
1608
+ " <td>500</td>\n",
1609
+ " <td>1.365200</td>\n",
1610
+ " </tr>\n",
1611
+ " <tr>\n",
1612
+ " <td>1000</td>\n",
1613
+ " <td>1.226200</td>\n",
1614
+ " </tr>\n",
1615
+ " <tr>\n",
1616
+ " <td>1500</td>\n",
1617
+ " <td>1.156000</td>\n",
1618
+ " </tr>\n",
1619
+ " <tr>\n",
1620
+ " <td>2000</td>\n",
1621
+ " <td>1.108600</td>\n",
1622
+ " </tr>\n",
1623
+ " <tr>\n",
1624
+ " <td>2500</td>\n",
1625
+ " <td>1.084900</td>\n",
1626
+ " </tr>\n",
1627
+ " <tr>\n",
1628
+ " <td>3000</td>\n",
1629
+ " <td>1.033100</td>\n",
1630
+ " </tr>\n",
1631
+ " <tr>\n",
1632
+ " <td>3500</td>\n",
1633
+ " <td>1.020700</td>\n",
1634
+ " </tr>\n",
1635
+ " <tr>\n",
1636
+ " <td>4000</td>\n",
1637
+ " <td>1.009600</td>\n",
1638
+ " </tr>\n",
1639
+ " <tr>\n",
1640
+ " <td>4500</td>\n",
1641
+ " <td>0.994900</td>\n",
1642
+ " </tr>\n",
1643
+ " <tr>\n",
1644
+ " <td>5000</td>\n",
1645
+ " <td>0.972800</td>\n",
1646
+ " </tr>\n",
1647
+ " <tr>\n",
1648
+ " <td>5500</td>\n",
1649
+ " <td>0.921200</td>\n",
1650
+ " </tr>\n",
1651
+ " <tr>\n",
1652
+ " <td>6000</td>\n",
1653
+ " <td>0.869000</td>\n",
1654
+ " </tr>\n",
1655
+ " <tr>\n",
1656
+ " <td>6500</td>\n",
1657
+ " <td>0.847500</td>\n",
1658
+ " </tr>\n",
1659
+ " <tr>\n",
1660
+ " <td>7000</td>\n",
1661
+ " <td>0.862500</td>\n",
1662
+ " </tr>\n",
1663
+ " <tr>\n",
1664
+ " <td>7500</td>\n",
1665
+ " <td>0.847000</td>\n",
1666
+ " </tr>\n",
1667
+ " <tr>\n",
1668
+ " <td>8000</td>\n",
1669
+ " <td>0.845800</td>\n",
1670
+ " </tr>\n",
1671
+ " <tr>\n",
1672
+ " <td>8500</td>\n",
1673
+ " <td>0.854900</td>\n",
1674
+ " </tr>\n",
1675
+ " <tr>\n",
1676
+ " <td>9000</td>\n",
1677
+ " <td>0.845700</td>\n",
1678
+ " </tr>\n",
1679
+ " <tr>\n",
1680
+ " <td>9500</td>\n",
1681
+ " <td>0.847800</td>\n",
1682
+ " </tr>\n",
1683
+ " <tr>\n",
1684
+ " <td>10000</td>\n",
1685
+ " <td>0.848000</td>\n",
1686
+ " </tr>\n",
1687
+ " <tr>\n",
1688
+ " <td>10500</td>\n",
1689
+ " <td>0.834000</td>\n",
1690
+ " </tr>\n",
1691
+ " <tr>\n",
1692
+ " <td>11000</td>\n",
1693
+ " <td>0.762500</td>\n",
1694
+ " </tr>\n",
1695
+ " <tr>\n",
1696
+ " <td>11500</td>\n",
1697
+ " <td>0.764200</td>\n",
1698
+ " </tr>\n",
1699
+ " <tr>\n",
1700
+ " <td>12000</td>\n",
1701
+ " <td>0.767400</td>\n",
1702
+ " </tr>\n",
1703
+ " <tr>\n",
1704
+ " <td>12500</td>\n",
1705
+ " <td>0.765000</td>\n",
1706
+ " </tr>\n",
1707
+ " <tr>\n",
1708
+ " <td>13000</td>\n",
1709
+ " <td>0.770000</td>\n",
1710
+ " </tr>\n",
1711
+ " <tr>\n",
1712
+ " <td>13500</td>\n",
1713
+ " <td>0.757100</td>\n",
1714
+ " </tr>\n",
1715
+ " <tr>\n",
1716
+ " <td>14000</td>\n",
1717
+ " <td>0.756700</td>\n",
1718
+ " </tr>\n",
1719
+ " <tr>\n",
1720
+ " <td>14500</td>\n",
1721
+ " <td>0.762700</td>\n",
1722
+ " </tr>\n",
1723
+ " <tr>\n",
1724
+ " <td>15000</td>\n",
1725
+ " <td>0.766800</td>\n",
1726
+ " </tr>\n",
1727
+ " <tr>\n",
1728
+ " <td>15500</td>\n",
1729
+ " <td>0.751000</td>\n",
1730
+ " </tr>\n",
1731
+ " </tbody>\n",
1732
+ "</table><p>"
1733
+ ]
1734
+ },
1735
+ "metadata": {}
1736
+ },
1737
+ {
1738
+ "output_type": "execute_result",
1739
+ "data": {
1740
+ "text/plain": [
1741
+ "TrainOutput(global_step=15765, training_loss=0.9012604572793396, metrics={'train_runtime': 2950.8187, 'train_samples_per_second': 170.94, 'train_steps_per_second': 5.343, 'total_flos': 1.008207288336384e+16, 'train_loss': 0.9012604572793396, 'epoch': 3.0})"
1742
+ ]
1743
+ },
1744
+ "metadata": {},
1745
+ "execution_count": 19
1746
+ }
1747
+ ]
1748
+ },
1749
+ {
1750
+ "cell_type": "code",
1751
+ "source": [
1752
+ "trainer.push_to_hub(tags=\"translation\", commit_message=\"Training complete\") #To save the latest model onto the repository"
1753
+ ],
1754
+ "metadata": {
1755
+ "colab": {
1756
+ "base_uri": "https://localhost:8080/",
1757
+ "height": 52
1758
+ },
1759
+ "id": "TnYcoiFLzU_f",
1760
+ "outputId": "b4080bed-d2f9-4e91-be88-0ae88d4a325e"
1761
+ },
1762
+ "execution_count": 20,
1763
+ "outputs": [
1764
+ {
1765
+ "output_type": "execute_result",
1766
+ "data": {
1767
+ "text/plain": [
1768
+ "CommitInfo(commit_url='https://huggingface.co/rajbhirud/eng-to-fra-model/commit/7dc6032cdedafc309f004b8d65493fbfe40fd5b7', commit_message='Training complete', commit_description='', oid='7dc6032cdedafc309f004b8d65493fbfe40fd5b7', pr_url=None, pr_revision=None, pr_num=None)"
1769
+ ],
1770
+ "application/vnd.google.colaboratory.intrinsic+json": {
1771
+ "type": "string"
1772
+ }
1773
+ },
1774
+ "metadata": {},
1775
+ "execution_count": 20
1776
+ }
1777
+ ]
1778
+ },
1779
+ {
1780
+ "cell_type": "code",
1781
+ "source": [
1782
+ "# we can check the score of our model through the following code\n",
1783
+ "trainer.evaluate(max_length=128)"
1784
+ ],
1785
+ "metadata": {
1786
+ "colab": {
1787
+ "base_uri": "https://localhost:8080/",
1788
+ "height": 141
1789
+ },
1790
+ "id": "mhf4dB0pzlA_",
1791
+ "outputId": "f92c5300-8f61-4f04-8a36-62d31028c467"
1792
+ },
1793
+ "execution_count": 21,
1794
+ "outputs": [
1795
+ {
1796
+ "output_type": "display_data",
1797
+ "data": {
1798
+ "text/plain": [
1799
+ "<IPython.core.display.HTML object>"
1800
+ ],
1801
+ "text/html": [
1802
+ "\n",
1803
+ " <div>\n",
1804
+ " \n",
1805
+ " <progress value='657' max='657' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
1806
+ " [657/657 45:14]\n",
1807
+ " </div>\n",
1808
+ " "
1809
+ ]
1810
+ },
1811
+ "metadata": {}
1812
+ },
1813
+ {
1814
+ "output_type": "execute_result",
1815
+ "data": {
1816
+ "text/plain": [
1817
+ "{'eval_loss': 0.8449926376342773,\n",
1818
+ " 'eval_bleu': 53.45040267621567,\n",
1819
+ " 'eval_runtime': 3010.6388,\n",
1820
+ " 'eval_samples_per_second': 13.962,\n",
1821
+ " 'eval_steps_per_second': 0.218,\n",
1822
+ " 'epoch': 3.0}"
1823
+ ]
1824
+ },
1825
+ "metadata": {},
1826
+ "execution_count": 21
1827
+ }
1828
+ ]
1829
+ },
1830
+ {
1831
+ "cell_type": "markdown",
1832
+ "source": [
1833
+ "To observe the model's performance interactively, particularly in language translation, we can leverage Gradio. A ready-to-use script, \"gradio_eng_to_fra.py\", has been provided in the repository. Executing this file enables seamless integration with the Gradio interface, offering users an intuitive platform for language translation without the need for extensive coding."
1834
+ ],
1835
+ "metadata": {
1836
+ "id": "qtHmvt340FXh"
1837
+ }
1838
+ }
1839
+ ]
1840
+ }