SaiKrishna-KK commited on
Commit
4c581ac
·
1 Parent(s): 83d4169

Implement masked language modeling using DistilBERT and TensorFlow

Browse files
Files changed (1) hide show
  1. HuggingFace_distilbert_base_cased.ipynb +533 -532
HuggingFace_distilbert_base_cased.ipynb CHANGED
@@ -1,385 +1,21 @@
1
  {
2
- "nbformat": 4,
3
- "nbformat_minor": 0,
4
- "metadata": {
5
- "colab": {
6
- "provenance": []
7
- },
8
- "kernelspec": {
9
- "name": "python3",
10
- "display_name": "Python 3"
11
- },
12
- "language_info": {
13
- "name": "python"
14
- },
15
- "accelerator": "GPU",
16
- "gpuClass": "standard",
17
- "widgets": {
18
- "application/vnd.jupyter.widget-state+json": {
19
- "5e84b1c5dd89477ca5fdc599967753a7": {
20
- "model_module": "@jupyter-widgets/controls",
21
- "model_name": "HBoxModel",
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": "HBoxModel",
28
- "_view_count": null,
29
- "_view_module": "@jupyter-widgets/controls",
30
- "_view_module_version": "1.5.0",
31
- "_view_name": "HBoxView",
32
- "box_style": "",
33
- "children": [
34
- "IPY_MODEL_af99709e68244dc5a7c398a16d0431b2",
35
- "IPY_MODEL_98607a2ca7164fcbbb6e5b66f448a80d",
36
- "IPY_MODEL_15c94c1e140e4212b5324d865ac89ff6"
37
- ],
38
- "layout": "IPY_MODEL_20192eab1c574b6e97d1fac97a35d037"
39
- }
40
- },
41
- "af99709e68244dc5a7c398a16d0431b2": {
42
- "model_module": "@jupyter-widgets/controls",
43
- "model_name": "HTMLModel",
44
- "model_module_version": "1.5.0",
45
- "state": {
46
- "_dom_classes": [],
47
- "_model_module": "@jupyter-widgets/controls",
48
- "_model_module_version": "1.5.0",
49
- "_model_name": "HTMLModel",
50
- "_view_count": null,
51
- "_view_module": "@jupyter-widgets/controls",
52
- "_view_module_version": "1.5.0",
53
- "_view_name": "HTMLView",
54
- "description": "",
55
- "description_tooltip": null,
56
- "layout": "IPY_MODEL_7196d8c5e35f4cbcb8a731324538dcf5",
57
- "placeholder": "​",
58
- "style": "IPY_MODEL_376942a321ec42b9aedd70f75ab531ad",
59
- "value": "100%"
60
- }
61
- },
62
- "98607a2ca7164fcbbb6e5b66f448a80d": {
63
- "model_module": "@jupyter-widgets/controls",
64
- "model_name": "FloatProgressModel",
65
- "model_module_version": "1.5.0",
66
- "state": {
67
- "_dom_classes": [],
68
- "_model_module": "@jupyter-widgets/controls",
69
- "_model_module_version": "1.5.0",
70
- "_model_name": "FloatProgressModel",
71
- "_view_count": null,
72
- "_view_module": "@jupyter-widgets/controls",
73
- "_view_module_version": "1.5.0",
74
- "_view_name": "ProgressView",
75
- "bar_style": "success",
76
- "description": "",
77
- "description_tooltip": null,
78
- "layout": "IPY_MODEL_cfbf71772b7643aca0d03bad779b4d26",
79
- "max": 3,
80
- "min": 0,
81
- "orientation": "horizontal",
82
- "style": "IPY_MODEL_58edb323ca6042b6a744cefecceca979",
83
- "value": 3
84
- }
85
- },
86
- "15c94c1e140e4212b5324d865ac89ff6": {
87
- "model_module": "@jupyter-widgets/controls",
88
- "model_name": "HTMLModel",
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": "HTMLModel",
95
- "_view_count": null,
96
- "_view_module": "@jupyter-widgets/controls",
97
- "_view_module_version": "1.5.0",
98
- "_view_name": "HTMLView",
99
- "description": "",
100
- "description_tooltip": null,
101
- "layout": "IPY_MODEL_47639638321f45abb64cc5666ee3ae0a",
102
- "placeholder": "​",
103
- "style": "IPY_MODEL_4cf84c560d9e48369a741cf622fcd80d",
104
- "value": " 3/3 [00:00<00:00, 106.19it/s]"
105
- }
106
- },
107
- "20192eab1c574b6e97d1fac97a35d037": {
108
- "model_module": "@jupyter-widgets/base",
109
- "model_name": "LayoutModel",
110
- "model_module_version": "1.2.0",
111
- "state": {
112
- "_model_module": "@jupyter-widgets/base",
113
- "_model_module_version": "1.2.0",
114
- "_model_name": "LayoutModel",
115
- "_view_count": null,
116
- "_view_module": "@jupyter-widgets/base",
117
- "_view_module_version": "1.2.0",
118
- "_view_name": "LayoutView",
119
- "align_content": null,
120
- "align_items": null,
121
- "align_self": null,
122
- "border": null,
123
- "bottom": null,
124
- "display": null,
125
- "flex": null,
126
- "flex_flow": null,
127
- "grid_area": null,
128
- "grid_auto_columns": null,
129
- "grid_auto_flow": null,
130
- "grid_auto_rows": null,
131
- "grid_column": null,
132
- "grid_gap": null,
133
- "grid_row": null,
134
- "grid_template_areas": null,
135
- "grid_template_columns": null,
136
- "grid_template_rows": null,
137
- "height": null,
138
- "justify_content": null,
139
- "justify_items": null,
140
- "left": null,
141
- "margin": null,
142
- "max_height": null,
143
- "max_width": null,
144
- "min_height": null,
145
- "min_width": null,
146
- "object_fit": null,
147
- "object_position": null,
148
- "order": null,
149
- "overflow": null,
150
- "overflow_x": null,
151
- "overflow_y": null,
152
- "padding": null,
153
- "right": null,
154
- "top": null,
155
- "visibility": null,
156
- "width": null
157
- }
158
- },
159
- "7196d8c5e35f4cbcb8a731324538dcf5": {
160
- "model_module": "@jupyter-widgets/base",
161
- "model_name": "LayoutModel",
162
- "model_module_version": "1.2.0",
163
- "state": {
164
- "_model_module": "@jupyter-widgets/base",
165
- "_model_module_version": "1.2.0",
166
- "_model_name": "LayoutModel",
167
- "_view_count": null,
168
- "_view_module": "@jupyter-widgets/base",
169
- "_view_module_version": "1.2.0",
170
- "_view_name": "LayoutView",
171
- "align_content": null,
172
- "align_items": null,
173
- "align_self": null,
174
- "border": null,
175
- "bottom": null,
176
- "display": null,
177
- "flex": null,
178
- "flex_flow": null,
179
- "grid_area": null,
180
- "grid_auto_columns": null,
181
- "grid_auto_flow": null,
182
- "grid_auto_rows": null,
183
- "grid_column": null,
184
- "grid_gap": null,
185
- "grid_row": null,
186
- "grid_template_areas": null,
187
- "grid_template_columns": null,
188
- "grid_template_rows": null,
189
- "height": null,
190
- "justify_content": null,
191
- "justify_items": null,
192
- "left": null,
193
- "margin": null,
194
- "max_height": null,
195
- "max_width": null,
196
- "min_height": null,
197
- "min_width": null,
198
- "object_fit": null,
199
- "object_position": null,
200
- "order": null,
201
- "overflow": null,
202
- "overflow_x": null,
203
- "overflow_y": null,
204
- "padding": null,
205
- "right": null,
206
- "top": null,
207
- "visibility": null,
208
- "width": null
209
- }
210
- },
211
- "376942a321ec42b9aedd70f75ab531ad": {
212
- "model_module": "@jupyter-widgets/controls",
213
- "model_name": "DescriptionStyleModel",
214
- "model_module_version": "1.5.0",
215
- "state": {
216
- "_model_module": "@jupyter-widgets/controls",
217
- "_model_module_version": "1.5.0",
218
- "_model_name": "DescriptionStyleModel",
219
- "_view_count": null,
220
- "_view_module": "@jupyter-widgets/base",
221
- "_view_module_version": "1.2.0",
222
- "_view_name": "StyleView",
223
- "description_width": ""
224
- }
225
- },
226
- "cfbf71772b7643aca0d03bad779b4d26": {
227
- "model_module": "@jupyter-widgets/base",
228
- "model_name": "LayoutModel",
229
- "model_module_version": "1.2.0",
230
- "state": {
231
- "_model_module": "@jupyter-widgets/base",
232
- "_model_module_version": "1.2.0",
233
- "_model_name": "LayoutModel",
234
- "_view_count": null,
235
- "_view_module": "@jupyter-widgets/base",
236
- "_view_module_version": "1.2.0",
237
- "_view_name": "LayoutView",
238
- "align_content": null,
239
- "align_items": null,
240
- "align_self": null,
241
- "border": null,
242
- "bottom": null,
243
- "display": null,
244
- "flex": null,
245
- "flex_flow": null,
246
- "grid_area": null,
247
- "grid_auto_columns": null,
248
- "grid_auto_flow": null,
249
- "grid_auto_rows": null,
250
- "grid_column": null,
251
- "grid_gap": null,
252
- "grid_row": null,
253
- "grid_template_areas": null,
254
- "grid_template_columns": null,
255
- "grid_template_rows": null,
256
- "height": null,
257
- "justify_content": null,
258
- "justify_items": null,
259
- "left": null,
260
- "margin": null,
261
- "max_height": null,
262
- "max_width": null,
263
- "min_height": null,
264
- "min_width": null,
265
- "object_fit": null,
266
- "object_position": null,
267
- "order": null,
268
- "overflow": null,
269
- "overflow_x": null,
270
- "overflow_y": null,
271
- "padding": null,
272
- "right": null,
273
- "top": null,
274
- "visibility": null,
275
- "width": null
276
- }
277
- },
278
- "58edb323ca6042b6a744cefecceca979": {
279
- "model_module": "@jupyter-widgets/controls",
280
- "model_name": "ProgressStyleModel",
281
- "model_module_version": "1.5.0",
282
- "state": {
283
- "_model_module": "@jupyter-widgets/controls",
284
- "_model_module_version": "1.5.0",
285
- "_model_name": "ProgressStyleModel",
286
- "_view_count": null,
287
- "_view_module": "@jupyter-widgets/base",
288
- "_view_module_version": "1.2.0",
289
- "_view_name": "StyleView",
290
- "bar_color": null,
291
- "description_width": ""
292
- }
293
- },
294
- "47639638321f45abb64cc5666ee3ae0a": {
295
- "model_module": "@jupyter-widgets/base",
296
- "model_name": "LayoutModel",
297
- "model_module_version": "1.2.0",
298
- "state": {
299
- "_model_module": "@jupyter-widgets/base",
300
- "_model_module_version": "1.2.0",
301
- "_model_name": "LayoutModel",
302
- "_view_count": null,
303
- "_view_module": "@jupyter-widgets/base",
304
- "_view_module_version": "1.2.0",
305
- "_view_name": "LayoutView",
306
- "align_content": null,
307
- "align_items": null,
308
- "align_self": null,
309
- "border": null,
310
- "bottom": null,
311
- "display": null,
312
- "flex": null,
313
- "flex_flow": null,
314
- "grid_area": null,
315
- "grid_auto_columns": null,
316
- "grid_auto_flow": null,
317
- "grid_auto_rows": null,
318
- "grid_column": null,
319
- "grid_gap": null,
320
- "grid_row": null,
321
- "grid_template_areas": null,
322
- "grid_template_columns": null,
323
- "grid_template_rows": null,
324
- "height": null,
325
- "justify_content": null,
326
- "justify_items": null,
327
- "left": null,
328
- "margin": null,
329
- "max_height": null,
330
- "max_width": null,
331
- "min_height": null,
332
- "min_width": null,
333
- "object_fit": null,
334
- "object_position": null,
335
- "order": null,
336
- "overflow": null,
337
- "overflow_x": null,
338
- "overflow_y": null,
339
- "padding": null,
340
- "right": null,
341
- "top": null,
342
- "visibility": null,
343
- "width": null
344
- }
345
- },
346
- "4cf84c560d9e48369a741cf622fcd80d": {
347
- "model_module": "@jupyter-widgets/controls",
348
- "model_name": "DescriptionStyleModel",
349
- "model_module_version": "1.5.0",
350
- "state": {
351
- "_model_module": "@jupyter-widgets/controls",
352
- "_model_module_version": "1.5.0",
353
- "_model_name": "DescriptionStyleModel",
354
- "_view_count": null,
355
- "_view_module": "@jupyter-widgets/base",
356
- "_view_module_version": "1.2.0",
357
- "_view_name": "StyleView",
358
- "description_width": ""
359
- }
360
- }
361
- }
362
- }
363
- },
364
  "cells": [
365
  {
366
  "cell_type": "markdown",
 
 
 
367
  "source": [
368
  "#Hugging-Face Internship Problem:\n",
369
  "1. Start by loading the wikitext-2-raw-v1 version of that dataset, and take the 11th example (index 10) of the train split.\n",
370
  "2. We'll tokenize this using the appropriate tokenizer, and we'll mask the sixth token (index 5) the sequence.\n",
371
  "\n",
372
  "- Q. When using the distilbert-base-cased checkpoint to unmask that (sixth token, index 5) token, what is the most probable predicted token (please provide the decoded token, and not the ID)?"
373
- ],
374
- "metadata": {
375
- "id": "hlxV8KZIRliB"
376
- }
377
  },
378
  {
379
  "cell_type": "code",
380
- "source": [
381
- "!pip install transformers"
382
- ],
383
  "metadata": {
384
  "colab": {
385
  "base_uri": "https://localhost:8080/"
@@ -387,11 +23,10 @@
387
  "id": "Sd4IxsstOyk2",
388
  "outputId": "90053639-6270-465f-8242-c01618957260"
389
  },
390
- "execution_count": 1,
391
  "outputs": [
392
  {
393
- "output_type": "stream",
394
  "name": "stdout",
 
395
  "text": [
396
  "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
397
  "Requirement already satisfied: transformers in /usr/local/lib/python3.9/dist-packages (4.27.4)\n",
@@ -411,13 +46,14 @@
411
  "Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.9/dist-packages (from requests->transformers) (2.0.12)\n"
412
  ]
413
  }
 
 
 
414
  ]
415
  },
416
  {
417
  "cell_type": "code",
418
- "source": [
419
- "!pip install datasets"
420
- ],
421
  "metadata": {
422
  "colab": {
423
  "base_uri": "https://localhost:8080/"
@@ -425,11 +61,10 @@
425
  "id": "-RKugi1hO672",
426
  "outputId": "9358d11a-0915-408a-d17e-fc06c052e560"
427
  },
428
- "execution_count": 2,
429
  "outputs": [
430
  {
431
- "output_type": "stream",
432
  "name": "stdout",
 
433
  "text": [
434
  "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
435
  "Requirement already satisfied: datasets in /usr/local/lib/python3.9/dist-packages (2.11.0)\n",
@@ -464,10 +99,16 @@
464
  "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.9/dist-packages (from python-dateutil>=2.8.1->pandas->datasets) (1.16.0)\n"
465
  ]
466
  }
 
 
 
467
  ]
468
  },
469
  {
470
  "cell_type": "markdown",
 
 
 
471
  "source": [
472
  "##Algorithimic Approach\n",
473
  "\n",
@@ -508,206 +149,566 @@
508
  "1. Print the most probable predicted token\n",
509
  "\n",
510
  "This algorithm outlines the steps necessary to predict the masked token in a given text using the pretrained DistilBERT model from the Hugging Face Transformers library with TensorFlow. It starts by importing the required libraries and modules, loading the pretrained tokenizer and model, and preprocessing the text. Then, it predicts the masked token, finds the most probable token, decodes it, and outputs the result.\n"
511
- ],
512
- "metadata": {
513
- "id": "Y87qgrjFQOm1"
514
- }
515
  },
516
  {
517
  "cell_type": "markdown",
518
- "source": [
519
- "Import the required libraries and modules: Import TensorFlow, TFDistilBertForMaskedLM (DistilBERT model for masked language modeling), and DistilBertTokenizer (tokenizer for the DistilBERT model)."
520
- ],
521
  "metadata": {
522
  "id": "_RckY6c4SvyY"
523
- }
 
 
 
524
  },
525
  {
526
  "cell_type": "code",
 
 
 
 
 
527
  "source": [
528
  "import tensorflow as tf\n",
529
  "from transformers import TFDistilBertForMaskedLM, DistilBertTokenizer"
530
- ],
 
 
 
531
  "metadata": {
532
- "id": "PHTLRdu4SSJS"
533
  },
534
- "execution_count": 3,
535
- "outputs": []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
536
  },
537
  {
538
  "cell_type": "markdown",
 
 
 
539
  "source": [
540
- "Load the tokenizer and the model: Instantiate the DistilBertTokenizer and TFDistilBertForMaskedLM using the 'distilbert-base-cased' pretrained model. The tokenizer is used to convert text into tokens, while the model is used to predict the masked token."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
  ],
 
 
 
 
 
 
 
 
 
542
  "metadata": {
543
- "id": "K8rNDpJpS450"
544
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
545
  },
546
  {
547
  "cell_type": "code",
 
 
 
 
 
548
  "source": [
549
- "# Load the tokenizer and the model\n",
550
- "tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-cased')\n",
551
- "model = TFDistilBertForMaskedLM.from_pretrained('distilbert-base-cased')"
552
- ],
 
 
 
 
 
 
553
  "metadata": {
554
  "colab": {
555
  "base_uri": "https://localhost:8080/"
556
  },
557
- "id": "ybWe9vMnSSdN",
558
- "outputId": "9f26ee41-42a0-48c7-e4a1-d3e41aa6afc6"
559
  },
560
- "execution_count": 4,
561
  "outputs": [
562
  {
 
563
  "output_type": "stream",
564
- "name": "stderr",
565
  "text": [
566
- "Some layers from the model checkpoint at distilbert-base-cased were not used when initializing TFDistilBertForMaskedLM: ['activation_13']\n",
567
- "- This IS expected if you are initializing TFDistilBertForMaskedLM from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n",
568
- "- This IS NOT expected if you are initializing TFDistilBertForMaskedLM from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n",
569
- "All the layers of TFDistilBertForMaskedLM were initialized from the model checkpoint at distilbert-base-cased.\n",
570
- "If your task is similar to the task the model of the checkpoint was trained on, you can already use TFDistilBertForMaskedLM for predictions without further training.\n"
571
  ]
572
  }
 
 
 
 
 
573
  ]
574
  },
575
  {
 
576
  "cell_type": "markdown",
577
- "source": [
578
- "Load the wikitext-2-raw-v1 dataset: Using the Hugging Face Datasets library, load the 'wikitext-2-raw-v1' dataset and extract the eleventh example (index 10) from the train split."
579
- ],
580
  "metadata": {
581
- "id": "-Ulr3fMhS9ZQ"
582
- }
583
- },
584
- {
585
- "cell_type": "code",
586
  "source": [
587
- "# Load wikitext-2-raw-v1 dataset\n",
588
- "from datasets import load_dataset\n",
589
- "wikitext_dataset = load_dataset('wikitext', 'wikitext-2-raw-v1')\n",
590
- "eleventh_example = wikitext_dataset['train'][10]['text']"
591
- ],
592
- "metadata": {
593
- "colab": {
594
- "base_uri": "https://localhost:8080/",
595
- "height": 66,
596
- "referenced_widgets": [
597
- "5e84b1c5dd89477ca5fdc599967753a7",
598
- "af99709e68244dc5a7c398a16d0431b2",
599
- "98607a2ca7164fcbbb6e5b66f448a80d",
600
- "15c94c1e140e4212b5324d865ac89ff6",
601
- "20192eab1c574b6e97d1fac97a35d037",
602
- "7196d8c5e35f4cbcb8a731324538dcf5",
603
- "376942a321ec42b9aedd70f75ab531ad",
604
- "cfbf71772b7643aca0d03bad779b4d26",
605
- "58edb323ca6042b6a744cefecceca979",
606
- "47639638321f45abb64cc5666ee3ae0a",
607
- "4cf84c560d9e48369a741cf622fcd80d"
608
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
609
  },
610
- "id": "GZSGMS8NSS66",
611
- "outputId": "8fbcf043-c7af-4264-98c9-b557c22b7b80"
612
- },
613
- "execution_count": 5,
614
- "outputs": [
615
- {
616
- "output_type": "stream",
617
- "name": "stderr",
618
- "text": [
619
- "WARNING:datasets.builder:Found cached dataset wikitext (/root/.cache/huggingface/datasets/wikitext/wikitext-2-raw-v1/1.0.0/a241db52902eaf2c6aa732210bead40c090019a499ceb13bcbfa3f8ab646a126)\n"
620
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
621
  },
622
- {
623
- "output_type": "display_data",
624
- "data": {
625
- "text/plain": [
626
- " 0%| | 0/3 [00:00<?, ?it/s]"
 
 
 
 
 
 
 
 
 
 
 
 
 
627
  ],
628
- "application/vnd.jupyter.widget-view+json": {
629
- "version_major": 2,
630
- "version_minor": 0,
631
- "model_id": "5e84b1c5dd89477ca5fdc599967753a7"
632
- }
633
- },
634
- "metadata": {}
635
- }
636
- ]
637
- },
638
- {
639
- "cell_type": "markdown",
640
- "source": [
641
- "Tokenize the text and mask the sixth token: Use the tokenizer to convert the eleventh example into tokens. Replace the sixth token (index 5) with the mask token from the tokenizer. Then, join the tokens into a single string and tokenize it again using the tokenizer, preparing the input tensors for the model."
642
- ],
643
- "metadata": {
644
- "id": "udOrZFymTDJc"
645
- }
646
- },
647
- {
648
- "cell_type": "code",
649
- "source": [
650
- "# Tokenize the text and mask the sixth token (index 5)\n",
651
- "tokens = tokenizer.tokenize(eleventh_example)\n",
652
- "tokens[5] = tokenizer.mask_token\n",
653
- "masked_text = ' '.join(tokens)\n",
654
- "inputs = tokenizer(masked_text, return_tensors='tf')"
655
- ],
656
- "metadata": {
657
- "id": "tPiIhTSASTHz"
658
- },
659
- "execution_count": 6,
660
- "outputs": []
661
- },
662
- {
663
- "cell_type": "code",
664
- "source": [
665
- "# Use the model to predict the masked token\n",
666
- "outputs = model(inputs)\n",
667
- "predictions = tf.nn.softmax(outputs.logits, axis=-1)\n",
668
- "masked_token_predictions = predictions[0, 5, :]\n",
669
- "top_token_id = tf.argmax(masked_token_predictions).numpy()"
670
- ],
671
- "metadata": {
672
- "id": "SDnjXKKRSZyw"
673
- },
674
- "execution_count": 7,
675
- "outputs": []
676
- },
677
- {
678
- "cell_type": "code",
679
- "source": [
680
- "# Decode the most probable token\n",
681
- "decoded_token = tokenizer.decode([top_token_id])\n",
682
- "print(f\"The most probable predicted token is: {decoded_token}\")\n"
683
- ],
684
- "metadata": {
685
- "colab": {
686
- "base_uri": "https://localhost:8080/"
687
  },
688
- "id": "kcDUy0H6QUHQ",
689
- "outputId": "19562b3c-00d8-43ee-ebc2-ab574fdd0fbe"
690
- },
691
- "execution_count": 8,
692
- "outputs": [
693
- {
694
- "output_type": "stream",
695
- "name": "stdout",
696
- "text": [
697
- "The most probable predicted token is: battle\n"
698
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
699
  }
700
- ]
701
- },
702
- {
703
- "cell_type": "markdown",
704
- "source": [
705
- "##Solution:\n",
706
- "The most probable predicted token when using the distilbert-base-cased checkpoint to unmask the sixth token (index 5) of the provided sequence is \"national\"."
707
- ],
708
- "metadata": {
709
- "id": "DBbt0oegRhmQ"
710
  }
711
  }
712
- ]
713
- }
 
 
 
1
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  "cells": [
3
  {
4
  "cell_type": "markdown",
5
+ "metadata": {
6
+ "id": "hlxV8KZIRliB"
7
+ },
8
  "source": [
9
  "#Hugging-Face Internship Problem:\n",
10
  "1. Start by loading the wikitext-2-raw-v1 version of that dataset, and take the 11th example (index 10) of the train split.\n",
11
  "2. We'll tokenize this using the appropriate tokenizer, and we'll mask the sixth token (index 5) the sequence.\n",
12
  "\n",
13
  "- Q. When using the distilbert-base-cased checkpoint to unmask that (sixth token, index 5) token, what is the most probable predicted token (please provide the decoded token, and not the ID)?"
14
+ ]
 
 
 
15
  },
16
  {
17
  "cell_type": "code",
18
+ "execution_count": 1,
 
 
19
  "metadata": {
20
  "colab": {
21
  "base_uri": "https://localhost:8080/"
 
23
  "id": "Sd4IxsstOyk2",
24
  "outputId": "90053639-6270-465f-8242-c01618957260"
25
  },
 
26
  "outputs": [
27
  {
 
28
  "name": "stdout",
29
+ "output_type": "stream",
30
  "text": [
31
  "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
32
  "Requirement already satisfied: transformers in /usr/local/lib/python3.9/dist-packages (4.27.4)\n",
 
46
  "Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.9/dist-packages (from requests->transformers) (2.0.12)\n"
47
  ]
48
  }
49
+ ],
50
+ "source": [
51
+ "!pip install transformers"
52
  ]
53
  },
54
  {
55
  "cell_type": "code",
56
+ "execution_count": 2,
 
 
57
  "metadata": {
58
  "colab": {
59
  "base_uri": "https://localhost:8080/"
 
61
  "id": "-RKugi1hO672",
62
  "outputId": "9358d11a-0915-408a-d17e-fc06c052e560"
63
  },
 
64
  "outputs": [
65
  {
 
66
  "name": "stdout",
67
+ "output_type": "stream",
68
  "text": [
69
  "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
70
  "Requirement already satisfied: datasets in /usr/local/lib/python3.9/dist-packages (2.11.0)\n",
 
99
  "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.9/dist-packages (from python-dateutil>=2.8.1->pandas->datasets) (1.16.0)\n"
100
  ]
101
  }
102
+ ],
103
+ "source": [
104
+ "!pip install datasets"
105
  ]
106
  },
107
  {
108
  "cell_type": "markdown",
109
+ "metadata": {
110
+ "id": "Y87qgrjFQOm1"
111
+ },
112
  "source": [
113
  "##Algorithimic Approach\n",
114
  "\n",
 
149
  "1. Print the most probable predicted token\n",
150
  "\n",
151
  "This algorithm outlines the steps necessary to predict the masked token in a given text using the pretrained DistilBERT model from the Hugging Face Transformers library with TensorFlow. It starts by importing the required libraries and modules, loading the pretrained tokenizer and model, and preprocessing the text. Then, it predicts the masked token, finds the most probable token, decodes it, and outputs the result.\n"
152
+ ]
 
 
 
153
  },
154
  {
155
  "cell_type": "markdown",
 
 
 
156
  "metadata": {
157
  "id": "_RckY6c4SvyY"
158
+ },
159
+ "source": [
160
+ "Import the required libraries and modules: Import TensorFlow, TFDistilBertForMaskedLM (DistilBERT model for masked language modeling), and DistilBertTokenizer (tokenizer for the DistilBERT model)."
161
+ ]
162
  },
163
  {
164
  "cell_type": "code",
165
+ "execution_count": 3,
166
+ "metadata": {
167
+ "id": "PHTLRdu4SSJS"
168
+ },
169
+ "outputs": [],
170
  "source": [
171
  "import tensorflow as tf\n",
172
  "from transformers import TFDistilBertForMaskedLM, DistilBertTokenizer"
173
+ ]
174
+ },
175
+ {
176
+ "cell_type": "markdown",
177
  "metadata": {
178
+ "id": "K8rNDpJpS450"
179
  },
180
+ "source": [
181
+ "Load the tokenizer and the model: Instantiate the DistilBertTokenizer and TFDistilBertForMaskedLM using the 'distilbert-base-cased' pretrained model. The tokenizer is used to convert text into tokens, while the model is used to predict the masked token."
182
+ ]
183
+ },
184
+ {
185
+ "cell_type": "code",
186
+ "execution_count": 4,
187
+ "metadata": {
188
+ "colab": {
189
+ "base_uri": "https://localhost:8080/"
190
+ },
191
+ "id": "ybWe9vMnSSdN",
192
+ "outputId": "9f26ee41-42a0-48c7-e4a1-d3e41aa6afc6"
193
+ },
194
+ "outputs": [
195
+ {
196
+ "name": "stderr",
197
+ "output_type": "stream",
198
+ "text": [
199
+ "Some layers from the model checkpoint at distilbert-base-cased were not used when initializing TFDistilBertForMaskedLM: ['activation_13']\n",
200
+ "- This IS expected if you are initializing TFDistilBertForMaskedLM from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n",
201
+ "- This IS NOT expected if you are initializing TFDistilBertForMaskedLM from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n",
202
+ "All the layers of TFDistilBertForMaskedLM were initialized from the model checkpoint at distilbert-base-cased.\n",
203
+ "If your task is similar to the task the model of the checkpoint was trained on, you can already use TFDistilBertForMaskedLM for predictions without further training.\n"
204
+ ]
205
+ }
206
+ ],
207
+ "source": [
208
+ "# Load the tokenizer and the model\n",
209
+ "tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-cased')\n",
210
+ "model = TFDistilBertForMaskedLM.from_pretrained('distilbert-base-cased')"
211
+ ]
212
  },
213
  {
214
  "cell_type": "markdown",
215
+ "metadata": {
216
+ "id": "-Ulr3fMhS9ZQ"
217
+ },
218
  "source": [
219
+ "Load the wikitext-2-raw-v1 dataset: Using the Hugging Face Datasets library, load the 'wikitext-2-raw-v1' dataset and extract the eleventh example (index 10) from the train split."
220
+ ]
221
+ },
222
+ {
223
+ "cell_type": "code",
224
+ "execution_count": 5,
225
+ "metadata": {
226
+ "colab": {
227
+ "base_uri": "https://localhost:8080/",
228
+ "height": 66,
229
+ "referenced_widgets": [
230
+ "5e84b1c5dd89477ca5fdc599967753a7",
231
+ "af99709e68244dc5a7c398a16d0431b2",
232
+ "98607a2ca7164fcbbb6e5b66f448a80d",
233
+ "15c94c1e140e4212b5324d865ac89ff6",
234
+ "20192eab1c574b6e97d1fac97a35d037",
235
+ "7196d8c5e35f4cbcb8a731324538dcf5",
236
+ "376942a321ec42b9aedd70f75ab531ad",
237
+ "cfbf71772b7643aca0d03bad779b4d26",
238
+ "58edb323ca6042b6a744cefecceca979",
239
+ "47639638321f45abb64cc5666ee3ae0a",
240
+ "4cf84c560d9e48369a741cf622fcd80d"
241
+ ]
242
+ },
243
+ "id": "GZSGMS8NSS66",
244
+ "outputId": "8fbcf043-c7af-4264-98c9-b557c22b7b80"
245
+ },
246
+ "outputs": [
247
+ {
248
+ "name": "stderr",
249
+ "output_type": "stream",
250
+ "text": [
251
+ "WARNING:datasets.builder:Found cached dataset wikitext (/root/.cache/huggingface/datasets/wikitext/wikitext-2-raw-v1/1.0.0/a241db52902eaf2c6aa732210bead40c090019a499ceb13bcbfa3f8ab646a126)\n"
252
+ ]
253
+ },
254
+ {
255
+ "data": {
256
+ "application/vnd.jupyter.widget-view+json": {
257
+ "model_id": "5e84b1c5dd89477ca5fdc599967753a7",
258
+ "version_major": 2,
259
+ "version_minor": 0
260
+ },
261
+ "text/plain": [
262
+ " 0%| | 0/3 [00:00<?, ?it/s]"
263
+ ]
264
+ },
265
+ "metadata": {},
266
+ "output_type": "display_data"
267
+ }
268
  ],
269
+ "source": [
270
+ "# Load wikitext-2-raw-v1 dataset\n",
271
+ "from datasets import load_dataset\n",
272
+ "wikitext_dataset = load_dataset('wikitext', 'wikitext-2-raw-v1')\n",
273
+ "eleventh_example = wikitext_dataset['train'][10]['text']"
274
+ ]
275
+ },
276
+ {
277
+ "cell_type": "markdown",
278
  "metadata": {
279
+ "id": "udOrZFymTDJc"
280
+ },
281
+ "source": [
282
+ "Tokenize the text and mask the sixth token: Use the tokenizer to convert the eleventh example into tokens. Replace the sixth token (index 5) with the mask token from the tokenizer. Then, join the tokens into a single string and tokenize it again using the tokenizer, preparing the input tensors for the model."
283
+ ]
284
+ },
285
+ {
286
+ "cell_type": "code",
287
+ "execution_count": 6,
288
+ "metadata": {
289
+ "id": "tPiIhTSASTHz"
290
+ },
291
+ "outputs": [],
292
+ "source": [
293
+ "# Tokenize the text and mask the sixth token (index 5)\n",
294
+ "tokens = tokenizer.tokenize(eleventh_example)\n",
295
+ "tokens[5] = tokenizer.mask_token\n",
296
+ "masked_text = ' '.join(tokens)\n",
297
+ "inputs = tokenizer(masked_text, return_tensors='tf')"
298
+ ]
299
  },
300
  {
301
  "cell_type": "code",
302
+ "execution_count": 7,
303
+ "metadata": {
304
+ "id": "SDnjXKKRSZyw"
305
+ },
306
+ "outputs": [],
307
  "source": [
308
+ "# Use the model to predict the masked token\n",
309
+ "outputs = model(inputs)\n",
310
+ "predictions = tf.nn.softmax(outputs.logits, axis=-1)\n",
311
+ "masked_token_predictions = predictions[0, 5, :]\n",
312
+ "top_token_id = tf.argmax(masked_token_predictions).numpy()"
313
+ ]
314
+ },
315
+ {
316
+ "cell_type": "code",
317
+ "execution_count": 8,
318
  "metadata": {
319
  "colab": {
320
  "base_uri": "https://localhost:8080/"
321
  },
322
+ "id": "kcDUy0H6QUHQ",
323
+ "outputId": "19562b3c-00d8-43ee-ebc2-ab574fdd0fbe"
324
  },
 
325
  "outputs": [
326
  {
327
+ "name": "stdout",
328
  "output_type": "stream",
 
329
  "text": [
330
+ "The most probable predicted token is: battle\n"
 
 
 
 
331
  ]
332
  }
333
+ ],
334
+ "source": [
335
+ "# Decode the most probable token\n",
336
+ "decoded_token = tokenizer.decode([top_token_id])\n",
337
+ "print(f\"The most probable predicted token is: {decoded_token}\")\n"
338
  ]
339
  },
340
  {
341
+ "attachments": {},
342
  "cell_type": "markdown",
 
 
 
343
  "metadata": {
344
+ "id": "DBbt0oegRhmQ"
345
+ },
 
 
 
346
  "source": [
347
+ "##Solution:\n",
348
+ "The most probable predicted token when using the distilbert-base-cased checkpoint to unmask the sixth token (index 5) of the provided sequence is \"battle\"."
349
+ ]
350
+ }
351
+ ],
352
+ "metadata": {
353
+ "accelerator": "GPU",
354
+ "colab": {
355
+ "provenance": []
356
+ },
357
+ "gpuClass": "standard",
358
+ "kernelspec": {
359
+ "display_name": "Python 3",
360
+ "name": "python3"
361
+ },
362
+ "language_info": {
363
+ "name": "python"
364
+ },
365
+ "widgets": {
366
+ "application/vnd.jupyter.widget-state+json": {
367
+ "15c94c1e140e4212b5324d865ac89ff6": {
368
+ "model_module": "@jupyter-widgets/controls",
369
+ "model_module_version": "1.5.0",
370
+ "model_name": "HTMLModel",
371
+ "state": {
372
+ "_dom_classes": [],
373
+ "_model_module": "@jupyter-widgets/controls",
374
+ "_model_module_version": "1.5.0",
375
+ "_model_name": "HTMLModel",
376
+ "_view_count": null,
377
+ "_view_module": "@jupyter-widgets/controls",
378
+ "_view_module_version": "1.5.0",
379
+ "_view_name": "HTMLView",
380
+ "description": "",
381
+ "description_tooltip": null,
382
+ "layout": "IPY_MODEL_47639638321f45abb64cc5666ee3ae0a",
383
+ "placeholder": "​",
384
+ "style": "IPY_MODEL_4cf84c560d9e48369a741cf622fcd80d",
385
+ "value": " 3/3 [00:00&lt;00:00, 106.19it/s]"
386
+ }
387
  },
388
+ "20192eab1c574b6e97d1fac97a35d037": {
389
+ "model_module": "@jupyter-widgets/base",
390
+ "model_module_version": "1.2.0",
391
+ "model_name": "LayoutModel",
392
+ "state": {
393
+ "_model_module": "@jupyter-widgets/base",
394
+ "_model_module_version": "1.2.0",
395
+ "_model_name": "LayoutModel",
396
+ "_view_count": null,
397
+ "_view_module": "@jupyter-widgets/base",
398
+ "_view_module_version": "1.2.0",
399
+ "_view_name": "LayoutView",
400
+ "align_content": null,
401
+ "align_items": null,
402
+ "align_self": null,
403
+ "border": null,
404
+ "bottom": null,
405
+ "display": null,
406
+ "flex": null,
407
+ "flex_flow": null,
408
+ "grid_area": null,
409
+ "grid_auto_columns": null,
410
+ "grid_auto_flow": null,
411
+ "grid_auto_rows": null,
412
+ "grid_column": null,
413
+ "grid_gap": null,
414
+ "grid_row": null,
415
+ "grid_template_areas": null,
416
+ "grid_template_columns": null,
417
+ "grid_template_rows": null,
418
+ "height": null,
419
+ "justify_content": null,
420
+ "justify_items": null,
421
+ "left": null,
422
+ "margin": null,
423
+ "max_height": null,
424
+ "max_width": null,
425
+ "min_height": null,
426
+ "min_width": null,
427
+ "object_fit": null,
428
+ "object_position": null,
429
+ "order": null,
430
+ "overflow": null,
431
+ "overflow_x": null,
432
+ "overflow_y": null,
433
+ "padding": null,
434
+ "right": null,
435
+ "top": null,
436
+ "visibility": null,
437
+ "width": null
438
+ }
439
+ },
440
+ "376942a321ec42b9aedd70f75ab531ad": {
441
+ "model_module": "@jupyter-widgets/controls",
442
+ "model_module_version": "1.5.0",
443
+ "model_name": "DescriptionStyleModel",
444
+ "state": {
445
+ "_model_module": "@jupyter-widgets/controls",
446
+ "_model_module_version": "1.5.0",
447
+ "_model_name": "DescriptionStyleModel",
448
+ "_view_count": null,
449
+ "_view_module": "@jupyter-widgets/base",
450
+ "_view_module_version": "1.2.0",
451
+ "_view_name": "StyleView",
452
+ "description_width": ""
453
+ }
454
+ },
455
+ "47639638321f45abb64cc5666ee3ae0a": {
456
+ "model_module": "@jupyter-widgets/base",
457
+ "model_module_version": "1.2.0",
458
+ "model_name": "LayoutModel",
459
+ "state": {
460
+ "_model_module": "@jupyter-widgets/base",
461
+ "_model_module_version": "1.2.0",
462
+ "_model_name": "LayoutModel",
463
+ "_view_count": null,
464
+ "_view_module": "@jupyter-widgets/base",
465
+ "_view_module_version": "1.2.0",
466
+ "_view_name": "LayoutView",
467
+ "align_content": null,
468
+ "align_items": null,
469
+ "align_self": null,
470
+ "border": null,
471
+ "bottom": null,
472
+ "display": null,
473
+ "flex": null,
474
+ "flex_flow": null,
475
+ "grid_area": null,
476
+ "grid_auto_columns": null,
477
+ "grid_auto_flow": null,
478
+ "grid_auto_rows": null,
479
+ "grid_column": null,
480
+ "grid_gap": null,
481
+ "grid_row": null,
482
+ "grid_template_areas": null,
483
+ "grid_template_columns": null,
484
+ "grid_template_rows": null,
485
+ "height": null,
486
+ "justify_content": null,
487
+ "justify_items": null,
488
+ "left": null,
489
+ "margin": null,
490
+ "max_height": null,
491
+ "max_width": null,
492
+ "min_height": null,
493
+ "min_width": null,
494
+ "object_fit": null,
495
+ "object_position": null,
496
+ "order": null,
497
+ "overflow": null,
498
+ "overflow_x": null,
499
+ "overflow_y": null,
500
+ "padding": null,
501
+ "right": null,
502
+ "top": null,
503
+ "visibility": null,
504
+ "width": null
505
+ }
506
+ },
507
+ "4cf84c560d9e48369a741cf622fcd80d": {
508
+ "model_module": "@jupyter-widgets/controls",
509
+ "model_module_version": "1.5.0",
510
+ "model_name": "DescriptionStyleModel",
511
+ "state": {
512
+ "_model_module": "@jupyter-widgets/controls",
513
+ "_model_module_version": "1.5.0",
514
+ "_model_name": "DescriptionStyleModel",
515
+ "_view_count": null,
516
+ "_view_module": "@jupyter-widgets/base",
517
+ "_view_module_version": "1.2.0",
518
+ "_view_name": "StyleView",
519
+ "description_width": ""
520
+ }
521
+ },
522
+ "58edb323ca6042b6a744cefecceca979": {
523
+ "model_module": "@jupyter-widgets/controls",
524
+ "model_module_version": "1.5.0",
525
+ "model_name": "ProgressStyleModel",
526
+ "state": {
527
+ "_model_module": "@jupyter-widgets/controls",
528
+ "_model_module_version": "1.5.0",
529
+ "_model_name": "ProgressStyleModel",
530
+ "_view_count": null,
531
+ "_view_module": "@jupyter-widgets/base",
532
+ "_view_module_version": "1.2.0",
533
+ "_view_name": "StyleView",
534
+ "bar_color": null,
535
+ "description_width": ""
536
+ }
537
  },
538
+ "5e84b1c5dd89477ca5fdc599967753a7": {
539
+ "model_module": "@jupyter-widgets/controls",
540
+ "model_module_version": "1.5.0",
541
+ "model_name": "HBoxModel",
542
+ "state": {
543
+ "_dom_classes": [],
544
+ "_model_module": "@jupyter-widgets/controls",
545
+ "_model_module_version": "1.5.0",
546
+ "_model_name": "HBoxModel",
547
+ "_view_count": null,
548
+ "_view_module": "@jupyter-widgets/controls",
549
+ "_view_module_version": "1.5.0",
550
+ "_view_name": "HBoxView",
551
+ "box_style": "",
552
+ "children": [
553
+ "IPY_MODEL_af99709e68244dc5a7c398a16d0431b2",
554
+ "IPY_MODEL_98607a2ca7164fcbbb6e5b66f448a80d",
555
+ "IPY_MODEL_15c94c1e140e4212b5324d865ac89ff6"
556
  ],
557
+ "layout": "IPY_MODEL_20192eab1c574b6e97d1fac97a35d037"
558
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
  },
560
+ "7196d8c5e35f4cbcb8a731324538dcf5": {
561
+ "model_module": "@jupyter-widgets/base",
562
+ "model_module_version": "1.2.0",
563
+ "model_name": "LayoutModel",
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
+ "98607a2ca7164fcbbb6e5b66f448a80d": {
613
+ "model_module": "@jupyter-widgets/controls",
614
+ "model_module_version": "1.5.0",
615
+ "model_name": "FloatProgressModel",
616
+ "state": {
617
+ "_dom_classes": [],
618
+ "_model_module": "@jupyter-widgets/controls",
619
+ "_model_module_version": "1.5.0",
620
+ "_model_name": "FloatProgressModel",
621
+ "_view_count": null,
622
+ "_view_module": "@jupyter-widgets/controls",
623
+ "_view_module_version": "1.5.0",
624
+ "_view_name": "ProgressView",
625
+ "bar_style": "success",
626
+ "description": "",
627
+ "description_tooltip": null,
628
+ "layout": "IPY_MODEL_cfbf71772b7643aca0d03bad779b4d26",
629
+ "max": 3,
630
+ "min": 0,
631
+ "orientation": "horizontal",
632
+ "style": "IPY_MODEL_58edb323ca6042b6a744cefecceca979",
633
+ "value": 3
634
+ }
635
+ },
636
+ "af99709e68244dc5a7c398a16d0431b2": {
637
+ "model_module": "@jupyter-widgets/controls",
638
+ "model_module_version": "1.5.0",
639
+ "model_name": "HTMLModel",
640
+ "state": {
641
+ "_dom_classes": [],
642
+ "_model_module": "@jupyter-widgets/controls",
643
+ "_model_module_version": "1.5.0",
644
+ "_model_name": "HTMLModel",
645
+ "_view_count": null,
646
+ "_view_module": "@jupyter-widgets/controls",
647
+ "_view_module_version": "1.5.0",
648
+ "_view_name": "HTMLView",
649
+ "description": "",
650
+ "description_tooltip": null,
651
+ "layout": "IPY_MODEL_7196d8c5e35f4cbcb8a731324538dcf5",
652
+ "placeholder": "​",
653
+ "style": "IPY_MODEL_376942a321ec42b9aedd70f75ab531ad",
654
+ "value": "100%"
655
+ }
656
+ },
657
+ "cfbf71772b7643aca0d03bad779b4d26": {
658
+ "model_module": "@jupyter-widgets/base",
659
+ "model_module_version": "1.2.0",
660
+ "model_name": "LayoutModel",
661
+ "state": {
662
+ "_model_module": "@jupyter-widgets/base",
663
+ "_model_module_version": "1.2.0",
664
+ "_model_name": "LayoutModel",
665
+ "_view_count": null,
666
+ "_view_module": "@jupyter-widgets/base",
667
+ "_view_module_version": "1.2.0",
668
+ "_view_name": "LayoutView",
669
+ "align_content": null,
670
+ "align_items": null,
671
+ "align_self": null,
672
+ "border": null,
673
+ "bottom": null,
674
+ "display": null,
675
+ "flex": null,
676
+ "flex_flow": null,
677
+ "grid_area": null,
678
+ "grid_auto_columns": null,
679
+ "grid_auto_flow": null,
680
+ "grid_auto_rows": null,
681
+ "grid_column": null,
682
+ "grid_gap": null,
683
+ "grid_row": null,
684
+ "grid_template_areas": null,
685
+ "grid_template_columns": null,
686
+ "grid_template_rows": null,
687
+ "height": null,
688
+ "justify_content": null,
689
+ "justify_items": null,
690
+ "left": null,
691
+ "margin": null,
692
+ "max_height": null,
693
+ "max_width": null,
694
+ "min_height": null,
695
+ "min_width": null,
696
+ "object_fit": null,
697
+ "object_position": null,
698
+ "order": null,
699
+ "overflow": null,
700
+ "overflow_x": null,
701
+ "overflow_y": null,
702
+ "padding": null,
703
+ "right": null,
704
+ "top": null,
705
+ "visibility": null,
706
+ "width": null
707
+ }
708
  }
 
 
 
 
 
 
 
 
 
 
709
  }
710
  }
711
+ },
712
+ "nbformat": 4,
713
+ "nbformat_minor": 0
714
+ }