CynthiaCR commited on
Commit
ea4be2e
1 Parent(s): 9552b39

Neural Networks Model

Browse files
Files changed (1) hide show
  1. Emotion_Classifier (1).ipynb +2233 -0
Emotion_Classifier (1).ipynb ADDED
@@ -0,0 +1,2233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nbformat": 4,
3
+ "nbformat_minor": 0,
4
+ "metadata": {
5
+ "colab": {
6
+ "provenance": [],
7
+ "machine_shape": "hm",
8
+ "gpuType": "T4"
9
+ },
10
+ "kernelspec": {
11
+ "name": "python3",
12
+ "display_name": "Python 3"
13
+ },
14
+ "language_info": {
15
+ "name": "python"
16
+ },
17
+ "gpuClass": "standard",
18
+ "accelerator": "GPU",
19
+ "widgets": {
20
+ "application/vnd.jupyter.widget-state+json": {
21
+ "8edc67e952f34a8f945e2db51f9425ee": {
22
+ "model_module": "@jupyter-widgets/controls",
23
+ "model_name": "VBoxModel",
24
+ "model_module_version": "1.5.0",
25
+ "state": {
26
+ "_dom_classes": [],
27
+ "_model_module": "@jupyter-widgets/controls",
28
+ "_model_module_version": "1.5.0",
29
+ "_model_name": "VBoxModel",
30
+ "_view_count": null,
31
+ "_view_module": "@jupyter-widgets/controls",
32
+ "_view_module_version": "1.5.0",
33
+ "_view_name": "VBoxView",
34
+ "box_style": "",
35
+ "children": [
36
+ "IPY_MODEL_080f20bc389f485eba6f710ad28a0360",
37
+ "IPY_MODEL_73aac851a8ae485dbcda59638e1113f6",
38
+ "IPY_MODEL_4b6cd0b9424c4577957a3e10a890fa91",
39
+ "IPY_MODEL_1fc62562be594225adf880f49e467fe4",
40
+ "IPY_MODEL_33ba82aa3ee748d29445c1da004e01b3"
41
+ ],
42
+ "layout": "IPY_MODEL_44e15dc93ae64a6d972442e22c0cd2de"
43
+ }
44
+ },
45
+ "080f20bc389f485eba6f710ad28a0360": {
46
+ "model_module": "@jupyter-widgets/controls",
47
+ "model_name": "HTMLModel",
48
+ "model_module_version": "1.5.0",
49
+ "state": {
50
+ "_dom_classes": [],
51
+ "_model_module": "@jupyter-widgets/controls",
52
+ "_model_module_version": "1.5.0",
53
+ "_model_name": "HTMLModel",
54
+ "_view_count": null,
55
+ "_view_module": "@jupyter-widgets/controls",
56
+ "_view_module_version": "1.5.0",
57
+ "_view_name": "HTMLView",
58
+ "description": "",
59
+ "description_tooltip": null,
60
+ "layout": "IPY_MODEL_a880e3a9e7954c1f9d2f0ee8d85703e4",
61
+ "placeholder": "​",
62
+ "style": "IPY_MODEL_ddd514ab790a4c5fa032822cb58f6609",
63
+ "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>"
64
+ }
65
+ },
66
+ "73aac851a8ae485dbcda59638e1113f6": {
67
+ "model_module": "@jupyter-widgets/controls",
68
+ "model_name": "PasswordModel",
69
+ "model_module_version": "1.5.0",
70
+ "state": {
71
+ "_dom_classes": [],
72
+ "_model_module": "@jupyter-widgets/controls",
73
+ "_model_module_version": "1.5.0",
74
+ "_model_name": "PasswordModel",
75
+ "_view_count": null,
76
+ "_view_module": "@jupyter-widgets/controls",
77
+ "_view_module_version": "1.5.0",
78
+ "_view_name": "PasswordView",
79
+ "continuous_update": true,
80
+ "description": "Token:",
81
+ "description_tooltip": null,
82
+ "disabled": false,
83
+ "layout": "IPY_MODEL_5ff4185688f646dc806f779490d32b37",
84
+ "placeholder": "​",
85
+ "style": "IPY_MODEL_bedbd9c752d54e439583a6b276e9cb42",
86
+ "value": ""
87
+ }
88
+ },
89
+ "4b6cd0b9424c4577957a3e10a890fa91": {
90
+ "model_module": "@jupyter-widgets/controls",
91
+ "model_name": "CheckboxModel",
92
+ "model_module_version": "1.5.0",
93
+ "state": {
94
+ "_dom_classes": [],
95
+ "_model_module": "@jupyter-widgets/controls",
96
+ "_model_module_version": "1.5.0",
97
+ "_model_name": "CheckboxModel",
98
+ "_view_count": null,
99
+ "_view_module": "@jupyter-widgets/controls",
100
+ "_view_module_version": "1.5.0",
101
+ "_view_name": "CheckboxView",
102
+ "description": "Add token as git credential?",
103
+ "description_tooltip": null,
104
+ "disabled": false,
105
+ "indent": true,
106
+ "layout": "IPY_MODEL_40222f6a62854865a8a24e3ed82708c9",
107
+ "style": "IPY_MODEL_562f64d325534570a7f2aee188b73363",
108
+ "value": true
109
+ }
110
+ },
111
+ "1fc62562be594225adf880f49e467fe4": {
112
+ "model_module": "@jupyter-widgets/controls",
113
+ "model_name": "ButtonModel",
114
+ "model_module_version": "1.5.0",
115
+ "state": {
116
+ "_dom_classes": [],
117
+ "_model_module": "@jupyter-widgets/controls",
118
+ "_model_module_version": "1.5.0",
119
+ "_model_name": "ButtonModel",
120
+ "_view_count": null,
121
+ "_view_module": "@jupyter-widgets/controls",
122
+ "_view_module_version": "1.5.0",
123
+ "_view_name": "ButtonView",
124
+ "button_style": "",
125
+ "description": "Login",
126
+ "disabled": false,
127
+ "icon": "",
128
+ "layout": "IPY_MODEL_b19d32184744436ab999a0668bd79ef6",
129
+ "style": "IPY_MODEL_d0e7330628eb4f659478e335558d6345",
130
+ "tooltip": ""
131
+ }
132
+ },
133
+ "33ba82aa3ee748d29445c1da004e01b3": {
134
+ "model_module": "@jupyter-widgets/controls",
135
+ "model_name": "HTMLModel",
136
+ "model_module_version": "1.5.0",
137
+ "state": {
138
+ "_dom_classes": [],
139
+ "_model_module": "@jupyter-widgets/controls",
140
+ "_model_module_version": "1.5.0",
141
+ "_model_name": "HTMLModel",
142
+ "_view_count": null,
143
+ "_view_module": "@jupyter-widgets/controls",
144
+ "_view_module_version": "1.5.0",
145
+ "_view_name": "HTMLView",
146
+ "description": "",
147
+ "description_tooltip": null,
148
+ "layout": "IPY_MODEL_d7b27461e8074b51a5b92d819a953124",
149
+ "placeholder": "​",
150
+ "style": "IPY_MODEL_7c25bcf4491a4333b99f58970ee52e16",
151
+ "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>"
152
+ }
153
+ },
154
+ "44e15dc93ae64a6d972442e22c0cd2de": {
155
+ "model_module": "@jupyter-widgets/base",
156
+ "model_name": "LayoutModel",
157
+ "model_module_version": "1.2.0",
158
+ "state": {
159
+ "_model_module": "@jupyter-widgets/base",
160
+ "_model_module_version": "1.2.0",
161
+ "_model_name": "LayoutModel",
162
+ "_view_count": null,
163
+ "_view_module": "@jupyter-widgets/base",
164
+ "_view_module_version": "1.2.0",
165
+ "_view_name": "LayoutView",
166
+ "align_content": null,
167
+ "align_items": "center",
168
+ "align_self": null,
169
+ "border": null,
170
+ "bottom": null,
171
+ "display": "flex",
172
+ "flex": null,
173
+ "flex_flow": "column",
174
+ "grid_area": null,
175
+ "grid_auto_columns": null,
176
+ "grid_auto_flow": null,
177
+ "grid_auto_rows": null,
178
+ "grid_column": null,
179
+ "grid_gap": null,
180
+ "grid_row": null,
181
+ "grid_template_areas": null,
182
+ "grid_template_columns": null,
183
+ "grid_template_rows": null,
184
+ "height": null,
185
+ "justify_content": null,
186
+ "justify_items": null,
187
+ "left": null,
188
+ "margin": null,
189
+ "max_height": null,
190
+ "max_width": null,
191
+ "min_height": null,
192
+ "min_width": null,
193
+ "object_fit": null,
194
+ "object_position": null,
195
+ "order": null,
196
+ "overflow": null,
197
+ "overflow_x": null,
198
+ "overflow_y": null,
199
+ "padding": null,
200
+ "right": null,
201
+ "top": null,
202
+ "visibility": null,
203
+ "width": "50%"
204
+ }
205
+ },
206
+ "a880e3a9e7954c1f9d2f0ee8d85703e4": {
207
+ "model_module": "@jupyter-widgets/base",
208
+ "model_name": "LayoutModel",
209
+ "model_module_version": "1.2.0",
210
+ "state": {
211
+ "_model_module": "@jupyter-widgets/base",
212
+ "_model_module_version": "1.2.0",
213
+ "_model_name": "LayoutModel",
214
+ "_view_count": null,
215
+ "_view_module": "@jupyter-widgets/base",
216
+ "_view_module_version": "1.2.0",
217
+ "_view_name": "LayoutView",
218
+ "align_content": null,
219
+ "align_items": null,
220
+ "align_self": null,
221
+ "border": null,
222
+ "bottom": null,
223
+ "display": null,
224
+ "flex": null,
225
+ "flex_flow": null,
226
+ "grid_area": null,
227
+ "grid_auto_columns": null,
228
+ "grid_auto_flow": null,
229
+ "grid_auto_rows": null,
230
+ "grid_column": null,
231
+ "grid_gap": null,
232
+ "grid_row": null,
233
+ "grid_template_areas": null,
234
+ "grid_template_columns": null,
235
+ "grid_template_rows": null,
236
+ "height": null,
237
+ "justify_content": null,
238
+ "justify_items": null,
239
+ "left": null,
240
+ "margin": null,
241
+ "max_height": null,
242
+ "max_width": null,
243
+ "min_height": null,
244
+ "min_width": null,
245
+ "object_fit": null,
246
+ "object_position": null,
247
+ "order": null,
248
+ "overflow": null,
249
+ "overflow_x": null,
250
+ "overflow_y": null,
251
+ "padding": null,
252
+ "right": null,
253
+ "top": null,
254
+ "visibility": null,
255
+ "width": null
256
+ }
257
+ },
258
+ "ddd514ab790a4c5fa032822cb58f6609": {
259
+ "model_module": "@jupyter-widgets/controls",
260
+ "model_name": "DescriptionStyleModel",
261
+ "model_module_version": "1.5.0",
262
+ "state": {
263
+ "_model_module": "@jupyter-widgets/controls",
264
+ "_model_module_version": "1.5.0",
265
+ "_model_name": "DescriptionStyleModel",
266
+ "_view_count": null,
267
+ "_view_module": "@jupyter-widgets/base",
268
+ "_view_module_version": "1.2.0",
269
+ "_view_name": "StyleView",
270
+ "description_width": ""
271
+ }
272
+ },
273
+ "5ff4185688f646dc806f779490d32b37": {
274
+ "model_module": "@jupyter-widgets/base",
275
+ "model_name": "LayoutModel",
276
+ "model_module_version": "1.2.0",
277
+ "state": {
278
+ "_model_module": "@jupyter-widgets/base",
279
+ "_model_module_version": "1.2.0",
280
+ "_model_name": "LayoutModel",
281
+ "_view_count": null,
282
+ "_view_module": "@jupyter-widgets/base",
283
+ "_view_module_version": "1.2.0",
284
+ "_view_name": "LayoutView",
285
+ "align_content": null,
286
+ "align_items": null,
287
+ "align_self": null,
288
+ "border": null,
289
+ "bottom": null,
290
+ "display": null,
291
+ "flex": null,
292
+ "flex_flow": null,
293
+ "grid_area": null,
294
+ "grid_auto_columns": null,
295
+ "grid_auto_flow": null,
296
+ "grid_auto_rows": null,
297
+ "grid_column": null,
298
+ "grid_gap": null,
299
+ "grid_row": null,
300
+ "grid_template_areas": null,
301
+ "grid_template_columns": null,
302
+ "grid_template_rows": null,
303
+ "height": null,
304
+ "justify_content": null,
305
+ "justify_items": null,
306
+ "left": null,
307
+ "margin": null,
308
+ "max_height": null,
309
+ "max_width": null,
310
+ "min_height": null,
311
+ "min_width": null,
312
+ "object_fit": null,
313
+ "object_position": null,
314
+ "order": null,
315
+ "overflow": null,
316
+ "overflow_x": null,
317
+ "overflow_y": null,
318
+ "padding": null,
319
+ "right": null,
320
+ "top": null,
321
+ "visibility": null,
322
+ "width": null
323
+ }
324
+ },
325
+ "bedbd9c752d54e439583a6b276e9cb42": {
326
+ "model_module": "@jupyter-widgets/controls",
327
+ "model_name": "DescriptionStyleModel",
328
+ "model_module_version": "1.5.0",
329
+ "state": {
330
+ "_model_module": "@jupyter-widgets/controls",
331
+ "_model_module_version": "1.5.0",
332
+ "_model_name": "DescriptionStyleModel",
333
+ "_view_count": null,
334
+ "_view_module": "@jupyter-widgets/base",
335
+ "_view_module_version": "1.2.0",
336
+ "_view_name": "StyleView",
337
+ "description_width": ""
338
+ }
339
+ },
340
+ "40222f6a62854865a8a24e3ed82708c9": {
341
+ "model_module": "@jupyter-widgets/base",
342
+ "model_name": "LayoutModel",
343
+ "model_module_version": "1.2.0",
344
+ "state": {
345
+ "_model_module": "@jupyter-widgets/base",
346
+ "_model_module_version": "1.2.0",
347
+ "_model_name": "LayoutModel",
348
+ "_view_count": null,
349
+ "_view_module": "@jupyter-widgets/base",
350
+ "_view_module_version": "1.2.0",
351
+ "_view_name": "LayoutView",
352
+ "align_content": null,
353
+ "align_items": null,
354
+ "align_self": null,
355
+ "border": null,
356
+ "bottom": null,
357
+ "display": null,
358
+ "flex": null,
359
+ "flex_flow": null,
360
+ "grid_area": null,
361
+ "grid_auto_columns": null,
362
+ "grid_auto_flow": null,
363
+ "grid_auto_rows": null,
364
+ "grid_column": null,
365
+ "grid_gap": null,
366
+ "grid_row": null,
367
+ "grid_template_areas": null,
368
+ "grid_template_columns": null,
369
+ "grid_template_rows": null,
370
+ "height": null,
371
+ "justify_content": null,
372
+ "justify_items": null,
373
+ "left": null,
374
+ "margin": null,
375
+ "max_height": null,
376
+ "max_width": null,
377
+ "min_height": null,
378
+ "min_width": null,
379
+ "object_fit": null,
380
+ "object_position": null,
381
+ "order": null,
382
+ "overflow": null,
383
+ "overflow_x": null,
384
+ "overflow_y": null,
385
+ "padding": null,
386
+ "right": null,
387
+ "top": null,
388
+ "visibility": null,
389
+ "width": null
390
+ }
391
+ },
392
+ "562f64d325534570a7f2aee188b73363": {
393
+ "model_module": "@jupyter-widgets/controls",
394
+ "model_name": "DescriptionStyleModel",
395
+ "model_module_version": "1.5.0",
396
+ "state": {
397
+ "_model_module": "@jupyter-widgets/controls",
398
+ "_model_module_version": "1.5.0",
399
+ "_model_name": "DescriptionStyleModel",
400
+ "_view_count": null,
401
+ "_view_module": "@jupyter-widgets/base",
402
+ "_view_module_version": "1.2.0",
403
+ "_view_name": "StyleView",
404
+ "description_width": ""
405
+ }
406
+ },
407
+ "b19d32184744436ab999a0668bd79ef6": {
408
+ "model_module": "@jupyter-widgets/base",
409
+ "model_name": "LayoutModel",
410
+ "model_module_version": "1.2.0",
411
+ "state": {
412
+ "_model_module": "@jupyter-widgets/base",
413
+ "_model_module_version": "1.2.0",
414
+ "_model_name": "LayoutModel",
415
+ "_view_count": null,
416
+ "_view_module": "@jupyter-widgets/base",
417
+ "_view_module_version": "1.2.0",
418
+ "_view_name": "LayoutView",
419
+ "align_content": null,
420
+ "align_items": null,
421
+ "align_self": null,
422
+ "border": null,
423
+ "bottom": null,
424
+ "display": null,
425
+ "flex": null,
426
+ "flex_flow": null,
427
+ "grid_area": null,
428
+ "grid_auto_columns": null,
429
+ "grid_auto_flow": null,
430
+ "grid_auto_rows": null,
431
+ "grid_column": null,
432
+ "grid_gap": null,
433
+ "grid_row": null,
434
+ "grid_template_areas": null,
435
+ "grid_template_columns": null,
436
+ "grid_template_rows": null,
437
+ "height": null,
438
+ "justify_content": null,
439
+ "justify_items": null,
440
+ "left": null,
441
+ "margin": null,
442
+ "max_height": null,
443
+ "max_width": null,
444
+ "min_height": null,
445
+ "min_width": null,
446
+ "object_fit": null,
447
+ "object_position": null,
448
+ "order": null,
449
+ "overflow": null,
450
+ "overflow_x": null,
451
+ "overflow_y": null,
452
+ "padding": null,
453
+ "right": null,
454
+ "top": null,
455
+ "visibility": null,
456
+ "width": null
457
+ }
458
+ },
459
+ "d0e7330628eb4f659478e335558d6345": {
460
+ "model_module": "@jupyter-widgets/controls",
461
+ "model_name": "ButtonStyleModel",
462
+ "model_module_version": "1.5.0",
463
+ "state": {
464
+ "_model_module": "@jupyter-widgets/controls",
465
+ "_model_module_version": "1.5.0",
466
+ "_model_name": "ButtonStyleModel",
467
+ "_view_count": null,
468
+ "_view_module": "@jupyter-widgets/base",
469
+ "_view_module_version": "1.2.0",
470
+ "_view_name": "StyleView",
471
+ "button_color": null,
472
+ "font_weight": ""
473
+ }
474
+ },
475
+ "d7b27461e8074b51a5b92d819a953124": {
476
+ "model_module": "@jupyter-widgets/base",
477
+ "model_name": "LayoutModel",
478
+ "model_module_version": "1.2.0",
479
+ "state": {
480
+ "_model_module": "@jupyter-widgets/base",
481
+ "_model_module_version": "1.2.0",
482
+ "_model_name": "LayoutModel",
483
+ "_view_count": null,
484
+ "_view_module": "@jupyter-widgets/base",
485
+ "_view_module_version": "1.2.0",
486
+ "_view_name": "LayoutView",
487
+ "align_content": null,
488
+ "align_items": null,
489
+ "align_self": null,
490
+ "border": null,
491
+ "bottom": null,
492
+ "display": null,
493
+ "flex": null,
494
+ "flex_flow": null,
495
+ "grid_area": null,
496
+ "grid_auto_columns": null,
497
+ "grid_auto_flow": null,
498
+ "grid_auto_rows": null,
499
+ "grid_column": null,
500
+ "grid_gap": null,
501
+ "grid_row": null,
502
+ "grid_template_areas": null,
503
+ "grid_template_columns": null,
504
+ "grid_template_rows": null,
505
+ "height": null,
506
+ "justify_content": null,
507
+ "justify_items": null,
508
+ "left": null,
509
+ "margin": null,
510
+ "max_height": null,
511
+ "max_width": null,
512
+ "min_height": null,
513
+ "min_width": null,
514
+ "object_fit": null,
515
+ "object_position": null,
516
+ "order": null,
517
+ "overflow": null,
518
+ "overflow_x": null,
519
+ "overflow_y": null,
520
+ "padding": null,
521
+ "right": null,
522
+ "top": null,
523
+ "visibility": null,
524
+ "width": null
525
+ }
526
+ },
527
+ "7c25bcf4491a4333b99f58970ee52e16": {
528
+ "model_module": "@jupyter-widgets/controls",
529
+ "model_name": "DescriptionStyleModel",
530
+ "model_module_version": "1.5.0",
531
+ "state": {
532
+ "_model_module": "@jupyter-widgets/controls",
533
+ "_model_module_version": "1.5.0",
534
+ "_model_name": "DescriptionStyleModel",
535
+ "_view_count": null,
536
+ "_view_module": "@jupyter-widgets/base",
537
+ "_view_module_version": "1.2.0",
538
+ "_view_name": "StyleView",
539
+ "description_width": ""
540
+ }
541
+ },
542
+ "a965aa730e164b249ff040457c944d94": {
543
+ "model_module": "@jupyter-widgets/controls",
544
+ "model_name": "HBoxModel",
545
+ "model_module_version": "1.5.0",
546
+ "state": {
547
+ "_dom_classes": [],
548
+ "_model_module": "@jupyter-widgets/controls",
549
+ "_model_module_version": "1.5.0",
550
+ "_model_name": "HBoxModel",
551
+ "_view_count": null,
552
+ "_view_module": "@jupyter-widgets/controls",
553
+ "_view_module_version": "1.5.0",
554
+ "_view_name": "HBoxView",
555
+ "box_style": "",
556
+ "children": [
557
+ "IPY_MODEL_cdefc2d658bc4bd3ba8b3b4d0affd263",
558
+ "IPY_MODEL_f41f320a42c54f90996b54af83689aff",
559
+ "IPY_MODEL_833a251db60140a598b9b4d28583271b"
560
+ ],
561
+ "layout": "IPY_MODEL_b157a9c50b834c24acc1445c803c670c"
562
+ }
563
+ },
564
+ "cdefc2d658bc4bd3ba8b3b4d0affd263": {
565
+ "model_module": "@jupyter-widgets/controls",
566
+ "model_name": "HTMLModel",
567
+ "model_module_version": "1.5.0",
568
+ "state": {
569
+ "_dom_classes": [],
570
+ "_model_module": "@jupyter-widgets/controls",
571
+ "_model_module_version": "1.5.0",
572
+ "_model_name": "HTMLModel",
573
+ "_view_count": null,
574
+ "_view_module": "@jupyter-widgets/controls",
575
+ "_view_module_version": "1.5.0",
576
+ "_view_name": "HTMLView",
577
+ "description": "",
578
+ "description_tooltip": null,
579
+ "layout": "IPY_MODEL_64deb634ee7249ad8ed9bd93c1979459",
580
+ "placeholder": "​",
581
+ "style": "IPY_MODEL_b41049a008604c1ab7bdb4646092628d",
582
+ "value": "Upload file tf_model.h5: 100%"
583
+ }
584
+ },
585
+ "f41f320a42c54f90996b54af83689aff": {
586
+ "model_module": "@jupyter-widgets/controls",
587
+ "model_name": "FloatProgressModel",
588
+ "model_module_version": "1.5.0",
589
+ "state": {
590
+ "_dom_classes": [],
591
+ "_model_module": "@jupyter-widgets/controls",
592
+ "_model_module_version": "1.5.0",
593
+ "_model_name": "FloatProgressModel",
594
+ "_view_count": null,
595
+ "_view_module": "@jupyter-widgets/controls",
596
+ "_view_module_version": "1.5.0",
597
+ "_view_name": "ProgressView",
598
+ "bar_style": "success",
599
+ "description": "",
600
+ "description_tooltip": null,
601
+ "layout": "IPY_MODEL_6d971fa517aa4c1295522279f29f0258",
602
+ "max": 343504568,
603
+ "min": 0,
604
+ "orientation": "horizontal",
605
+ "style": "IPY_MODEL_4f316fbfcf3644cd84a3f146265c9ba2",
606
+ "value": 343504568
607
+ }
608
+ },
609
+ "833a251db60140a598b9b4d28583271b": {
610
+ "model_module": "@jupyter-widgets/controls",
611
+ "model_name": "HTMLModel",
612
+ "model_module_version": "1.5.0",
613
+ "state": {
614
+ "_dom_classes": [],
615
+ "_model_module": "@jupyter-widgets/controls",
616
+ "_model_module_version": "1.5.0",
617
+ "_model_name": "HTMLModel",
618
+ "_view_count": null,
619
+ "_view_module": "@jupyter-widgets/controls",
620
+ "_view_module_version": "1.5.0",
621
+ "_view_name": "HTMLView",
622
+ "description": "",
623
+ "description_tooltip": null,
624
+ "layout": "IPY_MODEL_06067b563aa54cc386e4954a9702042f",
625
+ "placeholder": "​",
626
+ "style": "IPY_MODEL_e2dca77a089e43caa918174707165b56",
627
+ "value": " 328M/328M [00:08&lt;00:00, 53.7MB/s]"
628
+ }
629
+ },
630
+ "b157a9c50b834c24acc1445c803c670c": {
631
+ "model_module": "@jupyter-widgets/base",
632
+ "model_name": "LayoutModel",
633
+ "model_module_version": "1.2.0",
634
+ "state": {
635
+ "_model_module": "@jupyter-widgets/base",
636
+ "_model_module_version": "1.2.0",
637
+ "_model_name": "LayoutModel",
638
+ "_view_count": null,
639
+ "_view_module": "@jupyter-widgets/base",
640
+ "_view_module_version": "1.2.0",
641
+ "_view_name": "LayoutView",
642
+ "align_content": null,
643
+ "align_items": null,
644
+ "align_self": null,
645
+ "border": null,
646
+ "bottom": null,
647
+ "display": null,
648
+ "flex": null,
649
+ "flex_flow": null,
650
+ "grid_area": null,
651
+ "grid_auto_columns": null,
652
+ "grid_auto_flow": null,
653
+ "grid_auto_rows": null,
654
+ "grid_column": null,
655
+ "grid_gap": null,
656
+ "grid_row": null,
657
+ "grid_template_areas": null,
658
+ "grid_template_columns": null,
659
+ "grid_template_rows": null,
660
+ "height": null,
661
+ "justify_content": null,
662
+ "justify_items": null,
663
+ "left": null,
664
+ "margin": null,
665
+ "max_height": null,
666
+ "max_width": null,
667
+ "min_height": null,
668
+ "min_width": null,
669
+ "object_fit": null,
670
+ "object_position": null,
671
+ "order": null,
672
+ "overflow": null,
673
+ "overflow_x": null,
674
+ "overflow_y": null,
675
+ "padding": null,
676
+ "right": null,
677
+ "top": null,
678
+ "visibility": null,
679
+ "width": null
680
+ }
681
+ },
682
+ "64deb634ee7249ad8ed9bd93c1979459": {
683
+ "model_module": "@jupyter-widgets/base",
684
+ "model_name": "LayoutModel",
685
+ "model_module_version": "1.2.0",
686
+ "state": {
687
+ "_model_module": "@jupyter-widgets/base",
688
+ "_model_module_version": "1.2.0",
689
+ "_model_name": "LayoutModel",
690
+ "_view_count": null,
691
+ "_view_module": "@jupyter-widgets/base",
692
+ "_view_module_version": "1.2.0",
693
+ "_view_name": "LayoutView",
694
+ "align_content": null,
695
+ "align_items": null,
696
+ "align_self": null,
697
+ "border": null,
698
+ "bottom": null,
699
+ "display": null,
700
+ "flex": null,
701
+ "flex_flow": null,
702
+ "grid_area": null,
703
+ "grid_auto_columns": null,
704
+ "grid_auto_flow": null,
705
+ "grid_auto_rows": null,
706
+ "grid_column": null,
707
+ "grid_gap": null,
708
+ "grid_row": null,
709
+ "grid_template_areas": null,
710
+ "grid_template_columns": null,
711
+ "grid_template_rows": null,
712
+ "height": null,
713
+ "justify_content": null,
714
+ "justify_items": null,
715
+ "left": null,
716
+ "margin": null,
717
+ "max_height": null,
718
+ "max_width": null,
719
+ "min_height": null,
720
+ "min_width": null,
721
+ "object_fit": null,
722
+ "object_position": null,
723
+ "order": null,
724
+ "overflow": null,
725
+ "overflow_x": null,
726
+ "overflow_y": null,
727
+ "padding": null,
728
+ "right": null,
729
+ "top": null,
730
+ "visibility": null,
731
+ "width": null
732
+ }
733
+ },
734
+ "b41049a008604c1ab7bdb4646092628d": {
735
+ "model_module": "@jupyter-widgets/controls",
736
+ "model_name": "DescriptionStyleModel",
737
+ "model_module_version": "1.5.0",
738
+ "state": {
739
+ "_model_module": "@jupyter-widgets/controls",
740
+ "_model_module_version": "1.5.0",
741
+ "_model_name": "DescriptionStyleModel",
742
+ "_view_count": null,
743
+ "_view_module": "@jupyter-widgets/base",
744
+ "_view_module_version": "1.2.0",
745
+ "_view_name": "StyleView",
746
+ "description_width": ""
747
+ }
748
+ },
749
+ "6d971fa517aa4c1295522279f29f0258": {
750
+ "model_module": "@jupyter-widgets/base",
751
+ "model_name": "LayoutModel",
752
+ "model_module_version": "1.2.0",
753
+ "state": {
754
+ "_model_module": "@jupyter-widgets/base",
755
+ "_model_module_version": "1.2.0",
756
+ "_model_name": "LayoutModel",
757
+ "_view_count": null,
758
+ "_view_module": "@jupyter-widgets/base",
759
+ "_view_module_version": "1.2.0",
760
+ "_view_name": "LayoutView",
761
+ "align_content": null,
762
+ "align_items": null,
763
+ "align_self": null,
764
+ "border": null,
765
+ "bottom": null,
766
+ "display": null,
767
+ "flex": null,
768
+ "flex_flow": null,
769
+ "grid_area": null,
770
+ "grid_auto_columns": null,
771
+ "grid_auto_flow": null,
772
+ "grid_auto_rows": null,
773
+ "grid_column": null,
774
+ "grid_gap": null,
775
+ "grid_row": null,
776
+ "grid_template_areas": null,
777
+ "grid_template_columns": null,
778
+ "grid_template_rows": null,
779
+ "height": null,
780
+ "justify_content": null,
781
+ "justify_items": null,
782
+ "left": null,
783
+ "margin": null,
784
+ "max_height": null,
785
+ "max_width": null,
786
+ "min_height": null,
787
+ "min_width": null,
788
+ "object_fit": null,
789
+ "object_position": null,
790
+ "order": null,
791
+ "overflow": null,
792
+ "overflow_x": null,
793
+ "overflow_y": null,
794
+ "padding": null,
795
+ "right": null,
796
+ "top": null,
797
+ "visibility": null,
798
+ "width": null
799
+ }
800
+ },
801
+ "4f316fbfcf3644cd84a3f146265c9ba2": {
802
+ "model_module": "@jupyter-widgets/controls",
803
+ "model_name": "ProgressStyleModel",
804
+ "model_module_version": "1.5.0",
805
+ "state": {
806
+ "_model_module": "@jupyter-widgets/controls",
807
+ "_model_module_version": "1.5.0",
808
+ "_model_name": "ProgressStyleModel",
809
+ "_view_count": null,
810
+ "_view_module": "@jupyter-widgets/base",
811
+ "_view_module_version": "1.2.0",
812
+ "_view_name": "StyleView",
813
+ "bar_color": null,
814
+ "description_width": ""
815
+ }
816
+ },
817
+ "06067b563aa54cc386e4954a9702042f": {
818
+ "model_module": "@jupyter-widgets/base",
819
+ "model_name": "LayoutModel",
820
+ "model_module_version": "1.2.0",
821
+ "state": {
822
+ "_model_module": "@jupyter-widgets/base",
823
+ "_model_module_version": "1.2.0",
824
+ "_model_name": "LayoutModel",
825
+ "_view_count": null,
826
+ "_view_module": "@jupyter-widgets/base",
827
+ "_view_module_version": "1.2.0",
828
+ "_view_name": "LayoutView",
829
+ "align_content": null,
830
+ "align_items": null,
831
+ "align_self": null,
832
+ "border": null,
833
+ "bottom": null,
834
+ "display": null,
835
+ "flex": null,
836
+ "flex_flow": null,
837
+ "grid_area": null,
838
+ "grid_auto_columns": null,
839
+ "grid_auto_flow": null,
840
+ "grid_auto_rows": null,
841
+ "grid_column": null,
842
+ "grid_gap": null,
843
+ "grid_row": null,
844
+ "grid_template_areas": null,
845
+ "grid_template_columns": null,
846
+ "grid_template_rows": null,
847
+ "height": null,
848
+ "justify_content": null,
849
+ "justify_items": null,
850
+ "left": null,
851
+ "margin": null,
852
+ "max_height": null,
853
+ "max_width": null,
854
+ "min_height": null,
855
+ "min_width": null,
856
+ "object_fit": null,
857
+ "object_position": null,
858
+ "order": null,
859
+ "overflow": null,
860
+ "overflow_x": null,
861
+ "overflow_y": null,
862
+ "padding": null,
863
+ "right": null,
864
+ "top": null,
865
+ "visibility": null,
866
+ "width": null
867
+ }
868
+ },
869
+ "e2dca77a089e43caa918174707165b56": {
870
+ "model_module": "@jupyter-widgets/controls",
871
+ "model_name": "DescriptionStyleModel",
872
+ "model_module_version": "1.5.0",
873
+ "state": {
874
+ "_model_module": "@jupyter-widgets/controls",
875
+ "_model_module_version": "1.5.0",
876
+ "_model_name": "DescriptionStyleModel",
877
+ "_view_count": null,
878
+ "_view_module": "@jupyter-widgets/base",
879
+ "_view_module_version": "1.2.0",
880
+ "_view_name": "StyleView",
881
+ "description_width": ""
882
+ }
883
+ },
884
+ "75599d75d500474db4e9ca8801af0ac6": {
885
+ "model_module": "@jupyter-widgets/controls",
886
+ "model_name": "HBoxModel",
887
+ "model_module_version": "1.5.0",
888
+ "state": {
889
+ "_dom_classes": [],
890
+ "_model_module": "@jupyter-widgets/controls",
891
+ "_model_module_version": "1.5.0",
892
+ "_model_name": "HBoxModel",
893
+ "_view_count": null,
894
+ "_view_module": "@jupyter-widgets/controls",
895
+ "_view_module_version": "1.5.0",
896
+ "_view_name": "HBoxView",
897
+ "box_style": "",
898
+ "children": [
899
+ "IPY_MODEL_5d8c864d082047b2a3b180985ae0b698",
900
+ "IPY_MODEL_502dd70810054869bb01aae69ab2431d",
901
+ "IPY_MODEL_53ff5a46800543d7a2e6ed532e0085eb"
902
+ ],
903
+ "layout": "IPY_MODEL_8a3110bdb7844528a867a3f2d0daf028"
904
+ }
905
+ },
906
+ "5d8c864d082047b2a3b180985ae0b698": {
907
+ "model_module": "@jupyter-widgets/controls",
908
+ "model_name": "HTMLModel",
909
+ "model_module_version": "1.5.0",
910
+ "state": {
911
+ "_dom_classes": [],
912
+ "_model_module": "@jupyter-widgets/controls",
913
+ "_model_module_version": "1.5.0",
914
+ "_model_name": "HTMLModel",
915
+ "_view_count": null,
916
+ "_view_module": "@jupyter-widgets/controls",
917
+ "_view_module_version": "1.5.0",
918
+ "_view_name": "HTMLView",
919
+ "description": "",
920
+ "description_tooltip": null,
921
+ "layout": "IPY_MODEL_dbceb3e2a8b144bd8a899e7778b9fb67",
922
+ "placeholder": "​",
923
+ "style": "IPY_MODEL_dc6982a803d34c2b9366323f44cf0ef7",
924
+ "value": "Downloading tf_model.h5: 100%"
925
+ }
926
+ },
927
+ "502dd70810054869bb01aae69ab2431d": {
928
+ "model_module": "@jupyter-widgets/controls",
929
+ "model_name": "FloatProgressModel",
930
+ "model_module_version": "1.5.0",
931
+ "state": {
932
+ "_dom_classes": [],
933
+ "_model_module": "@jupyter-widgets/controls",
934
+ "_model_module_version": "1.5.0",
935
+ "_model_name": "FloatProgressModel",
936
+ "_view_count": null,
937
+ "_view_module": "@jupyter-widgets/controls",
938
+ "_view_module_version": "1.5.0",
939
+ "_view_name": "ProgressView",
940
+ "bar_style": "success",
941
+ "description": "",
942
+ "description_tooltip": null,
943
+ "layout": "IPY_MODEL_e4fa00ecdf7e4878bd07e3e81d22f7b0",
944
+ "max": 343504568,
945
+ "min": 0,
946
+ "orientation": "horizontal",
947
+ "style": "IPY_MODEL_708979e23d1f4833b31b5c8f8c208cb4",
948
+ "value": 343504568
949
+ }
950
+ },
951
+ "53ff5a46800543d7a2e6ed532e0085eb": {
952
+ "model_module": "@jupyter-widgets/controls",
953
+ "model_name": "HTMLModel",
954
+ "model_module_version": "1.5.0",
955
+ "state": {
956
+ "_dom_classes": [],
957
+ "_model_module": "@jupyter-widgets/controls",
958
+ "_model_module_version": "1.5.0",
959
+ "_model_name": "HTMLModel",
960
+ "_view_count": null,
961
+ "_view_module": "@jupyter-widgets/controls",
962
+ "_view_module_version": "1.5.0",
963
+ "_view_name": "HTMLView",
964
+ "description": "",
965
+ "description_tooltip": null,
966
+ "layout": "IPY_MODEL_d0432428e4524f318bff7ccf2f91c6b4",
967
+ "placeholder": "​",
968
+ "style": "IPY_MODEL_25a5031e71144bf4bec62694c16f39e2",
969
+ "value": " 344M/344M [00:03&lt;00:00, 103MB/s]"
970
+ }
971
+ },
972
+ "8a3110bdb7844528a867a3f2d0daf028": {
973
+ "model_module": "@jupyter-widgets/base",
974
+ "model_name": "LayoutModel",
975
+ "model_module_version": "1.2.0",
976
+ "state": {
977
+ "_model_module": "@jupyter-widgets/base",
978
+ "_model_module_version": "1.2.0",
979
+ "_model_name": "LayoutModel",
980
+ "_view_count": null,
981
+ "_view_module": "@jupyter-widgets/base",
982
+ "_view_module_version": "1.2.0",
983
+ "_view_name": "LayoutView",
984
+ "align_content": null,
985
+ "align_items": null,
986
+ "align_self": null,
987
+ "border": null,
988
+ "bottom": null,
989
+ "display": null,
990
+ "flex": null,
991
+ "flex_flow": null,
992
+ "grid_area": null,
993
+ "grid_auto_columns": null,
994
+ "grid_auto_flow": null,
995
+ "grid_auto_rows": null,
996
+ "grid_column": null,
997
+ "grid_gap": null,
998
+ "grid_row": null,
999
+ "grid_template_areas": null,
1000
+ "grid_template_columns": null,
1001
+ "grid_template_rows": null,
1002
+ "height": null,
1003
+ "justify_content": null,
1004
+ "justify_items": null,
1005
+ "left": null,
1006
+ "margin": null,
1007
+ "max_height": null,
1008
+ "max_width": null,
1009
+ "min_height": null,
1010
+ "min_width": null,
1011
+ "object_fit": null,
1012
+ "object_position": null,
1013
+ "order": null,
1014
+ "overflow": null,
1015
+ "overflow_x": null,
1016
+ "overflow_y": null,
1017
+ "padding": null,
1018
+ "right": null,
1019
+ "top": null,
1020
+ "visibility": null,
1021
+ "width": null
1022
+ }
1023
+ },
1024
+ "dbceb3e2a8b144bd8a899e7778b9fb67": {
1025
+ "model_module": "@jupyter-widgets/base",
1026
+ "model_name": "LayoutModel",
1027
+ "model_module_version": "1.2.0",
1028
+ "state": {
1029
+ "_model_module": "@jupyter-widgets/base",
1030
+ "_model_module_version": "1.2.0",
1031
+ "_model_name": "LayoutModel",
1032
+ "_view_count": null,
1033
+ "_view_module": "@jupyter-widgets/base",
1034
+ "_view_module_version": "1.2.0",
1035
+ "_view_name": "LayoutView",
1036
+ "align_content": null,
1037
+ "align_items": null,
1038
+ "align_self": null,
1039
+ "border": null,
1040
+ "bottom": null,
1041
+ "display": null,
1042
+ "flex": null,
1043
+ "flex_flow": null,
1044
+ "grid_area": null,
1045
+ "grid_auto_columns": null,
1046
+ "grid_auto_flow": null,
1047
+ "grid_auto_rows": null,
1048
+ "grid_column": null,
1049
+ "grid_gap": null,
1050
+ "grid_row": null,
1051
+ "grid_template_areas": null,
1052
+ "grid_template_columns": null,
1053
+ "grid_template_rows": null,
1054
+ "height": null,
1055
+ "justify_content": null,
1056
+ "justify_items": null,
1057
+ "left": null,
1058
+ "margin": null,
1059
+ "max_height": null,
1060
+ "max_width": null,
1061
+ "min_height": null,
1062
+ "min_width": null,
1063
+ "object_fit": null,
1064
+ "object_position": null,
1065
+ "order": null,
1066
+ "overflow": null,
1067
+ "overflow_x": null,
1068
+ "overflow_y": null,
1069
+ "padding": null,
1070
+ "right": null,
1071
+ "top": null,
1072
+ "visibility": null,
1073
+ "width": null
1074
+ }
1075
+ },
1076
+ "dc6982a803d34c2b9366323f44cf0ef7": {
1077
+ "model_module": "@jupyter-widgets/controls",
1078
+ "model_name": "DescriptionStyleModel",
1079
+ "model_module_version": "1.5.0",
1080
+ "state": {
1081
+ "_model_module": "@jupyter-widgets/controls",
1082
+ "_model_module_version": "1.5.0",
1083
+ "_model_name": "DescriptionStyleModel",
1084
+ "_view_count": null,
1085
+ "_view_module": "@jupyter-widgets/base",
1086
+ "_view_module_version": "1.2.0",
1087
+ "_view_name": "StyleView",
1088
+ "description_width": ""
1089
+ }
1090
+ },
1091
+ "e4fa00ecdf7e4878bd07e3e81d22f7b0": {
1092
+ "model_module": "@jupyter-widgets/base",
1093
+ "model_name": "LayoutModel",
1094
+ "model_module_version": "1.2.0",
1095
+ "state": {
1096
+ "_model_module": "@jupyter-widgets/base",
1097
+ "_model_module_version": "1.2.0",
1098
+ "_model_name": "LayoutModel",
1099
+ "_view_count": null,
1100
+ "_view_module": "@jupyter-widgets/base",
1101
+ "_view_module_version": "1.2.0",
1102
+ "_view_name": "LayoutView",
1103
+ "align_content": null,
1104
+ "align_items": null,
1105
+ "align_self": null,
1106
+ "border": null,
1107
+ "bottom": null,
1108
+ "display": null,
1109
+ "flex": null,
1110
+ "flex_flow": null,
1111
+ "grid_area": null,
1112
+ "grid_auto_columns": null,
1113
+ "grid_auto_flow": null,
1114
+ "grid_auto_rows": null,
1115
+ "grid_column": null,
1116
+ "grid_gap": null,
1117
+ "grid_row": null,
1118
+ "grid_template_areas": null,
1119
+ "grid_template_columns": null,
1120
+ "grid_template_rows": null,
1121
+ "height": null,
1122
+ "justify_content": null,
1123
+ "justify_items": null,
1124
+ "left": null,
1125
+ "margin": null,
1126
+ "max_height": null,
1127
+ "max_width": null,
1128
+ "min_height": null,
1129
+ "min_width": null,
1130
+ "object_fit": null,
1131
+ "object_position": null,
1132
+ "order": null,
1133
+ "overflow": null,
1134
+ "overflow_x": null,
1135
+ "overflow_y": null,
1136
+ "padding": null,
1137
+ "right": null,
1138
+ "top": null,
1139
+ "visibility": null,
1140
+ "width": null
1141
+ }
1142
+ },
1143
+ "708979e23d1f4833b31b5c8f8c208cb4": {
1144
+ "model_module": "@jupyter-widgets/controls",
1145
+ "model_name": "ProgressStyleModel",
1146
+ "model_module_version": "1.5.0",
1147
+ "state": {
1148
+ "_model_module": "@jupyter-widgets/controls",
1149
+ "_model_module_version": "1.5.0",
1150
+ "_model_name": "ProgressStyleModel",
1151
+ "_view_count": null,
1152
+ "_view_module": "@jupyter-widgets/base",
1153
+ "_view_module_version": "1.2.0",
1154
+ "_view_name": "StyleView",
1155
+ "bar_color": null,
1156
+ "description_width": ""
1157
+ }
1158
+ },
1159
+ "d0432428e4524f318bff7ccf2f91c6b4": {
1160
+ "model_module": "@jupyter-widgets/base",
1161
+ "model_name": "LayoutModel",
1162
+ "model_module_version": "1.2.0",
1163
+ "state": {
1164
+ "_model_module": "@jupyter-widgets/base",
1165
+ "_model_module_version": "1.2.0",
1166
+ "_model_name": "LayoutModel",
1167
+ "_view_count": null,
1168
+ "_view_module": "@jupyter-widgets/base",
1169
+ "_view_module_version": "1.2.0",
1170
+ "_view_name": "LayoutView",
1171
+ "align_content": null,
1172
+ "align_items": null,
1173
+ "align_self": null,
1174
+ "border": null,
1175
+ "bottom": null,
1176
+ "display": null,
1177
+ "flex": null,
1178
+ "flex_flow": null,
1179
+ "grid_area": null,
1180
+ "grid_auto_columns": null,
1181
+ "grid_auto_flow": null,
1182
+ "grid_auto_rows": null,
1183
+ "grid_column": null,
1184
+ "grid_gap": null,
1185
+ "grid_row": null,
1186
+ "grid_template_areas": null,
1187
+ "grid_template_columns": null,
1188
+ "grid_template_rows": null,
1189
+ "height": null,
1190
+ "justify_content": null,
1191
+ "justify_items": null,
1192
+ "left": null,
1193
+ "margin": null,
1194
+ "max_height": null,
1195
+ "max_width": null,
1196
+ "min_height": null,
1197
+ "min_width": null,
1198
+ "object_fit": null,
1199
+ "object_position": null,
1200
+ "order": null,
1201
+ "overflow": null,
1202
+ "overflow_x": null,
1203
+ "overflow_y": null,
1204
+ "padding": null,
1205
+ "right": null,
1206
+ "top": null,
1207
+ "visibility": null,
1208
+ "width": null
1209
+ }
1210
+ },
1211
+ "25a5031e71144bf4bec62694c16f39e2": {
1212
+ "model_module": "@jupyter-widgets/controls",
1213
+ "model_name": "DescriptionStyleModel",
1214
+ "model_module_version": "1.5.0",
1215
+ "state": {
1216
+ "_model_module": "@jupyter-widgets/controls",
1217
+ "_model_module_version": "1.5.0",
1218
+ "_model_name": "DescriptionStyleModel",
1219
+ "_view_count": null,
1220
+ "_view_module": "@jupyter-widgets/base",
1221
+ "_view_module_version": "1.2.0",
1222
+ "_view_name": "StyleView",
1223
+ "description_width": ""
1224
+ }
1225
+ }
1226
+ }
1227
+ }
1228
+ },
1229
+ "cells": [
1230
+ {
1231
+ "cell_type": "code",
1232
+ "execution_count": 38,
1233
+ "metadata": {
1234
+ "colab": {
1235
+ "base_uri": "https://localhost:8080/"
1236
+ },
1237
+ "id": "YjdZ0vD5HQVO",
1238
+ "outputId": "ed8a7da7-9b11-4d29-8489-076c22d0e87f"
1239
+ },
1240
+ "outputs": [
1241
+ {
1242
+ "output_type": "stream",
1243
+ "name": "stdout",
1244
+ "text": [
1245
+ "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
1246
+ "Requirement already satisfied: transformers in /usr/local/lib/python3.10/dist-packages (4.29.2)\n",
1247
+ "Requirement already satisfied: datasets in /usr/local/lib/python3.10/dist-packages (2.12.0)\n",
1248
+ "Requirement already satisfied: evaluate in /usr/local/lib/python3.10/dist-packages (0.4.0)\n",
1249
+ "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from transformers) (3.12.0)\n",
1250
+ "Requirement already satisfied: huggingface-hub<1.0,>=0.14.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.14.1)\n",
1251
+ "Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (1.22.4)\n",
1252
+ "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from transformers) (23.1)\n",
1253
+ "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (6.0)\n",
1254
+ "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.10/dist-packages (from transformers) (2022.10.31)\n",
1255
+ "Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from transformers) (2.27.1)\n",
1256
+ "Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in /usr/local/lib/python3.10/dist-packages (from transformers) (0.13.3)\n",
1257
+ "Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.10/dist-packages (from transformers) (4.65.0)\n",
1258
+ "Requirement already satisfied: pyarrow>=8.0.0 in /usr/local/lib/python3.10/dist-packages (from datasets) (9.0.0)\n",
1259
+ "Requirement already satisfied: dill<0.3.7,>=0.3.0 in /usr/local/lib/python3.10/dist-packages (from datasets) (0.3.6)\n",
1260
+ "Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from datasets) (1.5.3)\n",
1261
+ "Requirement already satisfied: xxhash in /usr/local/lib/python3.10/dist-packages (from datasets) (3.2.0)\n",
1262
+ "Requirement already satisfied: multiprocess in /usr/local/lib/python3.10/dist-packages (from datasets) (0.70.14)\n",
1263
+ "Requirement already satisfied: fsspec[http]>=2021.11.1 in /usr/local/lib/python3.10/dist-packages (from datasets) (2023.4.0)\n",
1264
+ "Requirement already satisfied: aiohttp in /usr/local/lib/python3.10/dist-packages (from datasets) (3.8.4)\n",
1265
+ "Requirement already satisfied: responses<0.19 in /usr/local/lib/python3.10/dist-packages (from datasets) (0.18.0)\n",
1266
+ "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (23.1.0)\n",
1267
+ "Requirement already satisfied: charset-normalizer<4.0,>=2.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (2.0.12)\n",
1268
+ "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (6.0.4)\n",
1269
+ "Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (4.0.2)\n",
1270
+ "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.9.2)\n",
1271
+ "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.3.3)\n",
1272
+ "Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.3.1)\n",
1273
+ "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub<1.0,>=0.14.1->transformers) (4.5.0)\n",
1274
+ "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (1.26.15)\n",
1275
+ "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (2022.12.7)\n",
1276
+ "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->transformers) (3.4)\n",
1277
+ "Requirement already satisfied: python-dateutil>=2.8.1 in /usr/local/lib/python3.10/dist-packages (from pandas->datasets) (2.8.2)\n",
1278
+ "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->datasets) (2022.7.1)\n",
1279
+ "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.1->pandas->datasets) (1.16.0)\n"
1280
+ ]
1281
+ }
1282
+ ],
1283
+ "source": [
1284
+ "pip install transformers datasets evaluate"
1285
+ ]
1286
+ },
1287
+ {
1288
+ "cell_type": "code",
1289
+ "source": [
1290
+ "from huggingface_hub import notebook_login\n",
1291
+ "\n",
1292
+ "notebook_login()"
1293
+ ],
1294
+ "metadata": {
1295
+ "colab": {
1296
+ "base_uri": "https://localhost:8080/",
1297
+ "height": 415,
1298
+ "referenced_widgets": [
1299
+ "8edc67e952f34a8f945e2db51f9425ee",
1300
+ "080f20bc389f485eba6f710ad28a0360",
1301
+ "73aac851a8ae485dbcda59638e1113f6",
1302
+ "4b6cd0b9424c4577957a3e10a890fa91",
1303
+ "1fc62562be594225adf880f49e467fe4",
1304
+ "33ba82aa3ee748d29445c1da004e01b3",
1305
+ "44e15dc93ae64a6d972442e22c0cd2de",
1306
+ "a880e3a9e7954c1f9d2f0ee8d85703e4",
1307
+ "ddd514ab790a4c5fa032822cb58f6609",
1308
+ "5ff4185688f646dc806f779490d32b37",
1309
+ "bedbd9c752d54e439583a6b276e9cb42",
1310
+ "40222f6a62854865a8a24e3ed82708c9",
1311
+ "562f64d325534570a7f2aee188b73363",
1312
+ "b19d32184744436ab999a0668bd79ef6",
1313
+ "d0e7330628eb4f659478e335558d6345",
1314
+ "d7b27461e8074b51a5b92d819a953124",
1315
+ "7c25bcf4491a4333b99f58970ee52e16"
1316
+ ]
1317
+ },
1318
+ "id": "84mMJtzcHk3L",
1319
+ "outputId": "3fef96d3-6f52-4dca-89ae-055247f333d1"
1320
+ },
1321
+ "execution_count": 39,
1322
+ "outputs": [
1323
+ {
1324
+ "output_type": "display_data",
1325
+ "data": {
1326
+ "text/plain": [
1327
+ "VBox(children=(HTML(value='<center> <img\\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.sv…"
1328
+ ],
1329
+ "application/vnd.jupyter.widget-view+json": {
1330
+ "version_major": 2,
1331
+ "version_minor": 0,
1332
+ "model_id": "8edc67e952f34a8f945e2db51f9425ee"
1333
+ }
1334
+ },
1335
+ "metadata": {}
1336
+ }
1337
+ ]
1338
+ },
1339
+ {
1340
+ "cell_type": "code",
1341
+ "source": [
1342
+ "from datasets import load_dataset\n",
1343
+ "\n",
1344
+ "emotions_df = load_dataset(\"FastJobs/Visual_Emotional_Analysis\", split=\"train[:800]\") "
1345
+ ],
1346
+ "metadata": {
1347
+ "colab": {
1348
+ "base_uri": "https://localhost:8080/"
1349
+ },
1350
+ "id": "jePsbV2DHlCk",
1351
+ "outputId": "72fc3cd5-37c9-4f6a-f5d4-34327cd4cf03"
1352
+ },
1353
+ "execution_count": 40,
1354
+ "outputs": [
1355
+ {
1356
+ "output_type": "stream",
1357
+ "name": "stderr",
1358
+ "text": [
1359
+ "WARNING:datasets.builder:Found cached dataset imagefolder (/root/.cache/huggingface/datasets/FastJobs___imagefolder/FastJobs--Visual_Emotional_Analysis-bbb0f5e70847fc91/0.0.0/37fbb85cc714a338bea574ac6c7d0b5be5aff46c1862c1989b20e0771199e93f)\n"
1360
+ ]
1361
+ }
1362
+ ]
1363
+ },
1364
+ {
1365
+ "cell_type": "code",
1366
+ "source": [
1367
+ "len(emotions_df)"
1368
+ ],
1369
+ "metadata": {
1370
+ "colab": {
1371
+ "base_uri": "https://localhost:8080/"
1372
+ },
1373
+ "id": "PB3_wpmzJFsh",
1374
+ "outputId": "ae86b6e2-51d6-4c93-eb0e-acd7e428db53"
1375
+ },
1376
+ "execution_count": 41,
1377
+ "outputs": [
1378
+ {
1379
+ "output_type": "execute_result",
1380
+ "data": {
1381
+ "text/plain": [
1382
+ "800"
1383
+ ]
1384
+ },
1385
+ "metadata": {},
1386
+ "execution_count": 41
1387
+ }
1388
+ ]
1389
+ },
1390
+ {
1391
+ "cell_type": "code",
1392
+ "source": [
1393
+ "emotions_df = emotions_df.train_test_split(test_size=0.2)"
1394
+ ],
1395
+ "metadata": {
1396
+ "id": "5Nw4bJfTHlLT"
1397
+ },
1398
+ "execution_count": 42,
1399
+ "outputs": []
1400
+ },
1401
+ {
1402
+ "cell_type": "code",
1403
+ "source": [
1404
+ "# size of the train dataset\n",
1405
+ "len(emotions_df['train'])"
1406
+ ],
1407
+ "metadata": {
1408
+ "colab": {
1409
+ "base_uri": "https://localhost:8080/"
1410
+ },
1411
+ "id": "ppzENe5zRkxQ",
1412
+ "outputId": "06730bbc-80e6-4cac-f525-bc78eeadf233"
1413
+ },
1414
+ "execution_count": 43,
1415
+ "outputs": [
1416
+ {
1417
+ "output_type": "execute_result",
1418
+ "data": {
1419
+ "text/plain": [
1420
+ "640"
1421
+ ]
1422
+ },
1423
+ "metadata": {},
1424
+ "execution_count": 43
1425
+ }
1426
+ ]
1427
+ },
1428
+ {
1429
+ "cell_type": "code",
1430
+ "source": [
1431
+ "# size of the test dataset\n",
1432
+ "len(emotions_df['test'])"
1433
+ ],
1434
+ "metadata": {
1435
+ "colab": {
1436
+ "base_uri": "https://localhost:8080/"
1437
+ },
1438
+ "id": "wXnineZgRnLw",
1439
+ "outputId": "544690f7-d579-4ef4-aa0a-2671b8ecbcb2"
1440
+ },
1441
+ "execution_count": 44,
1442
+ "outputs": [
1443
+ {
1444
+ "output_type": "execute_result",
1445
+ "data": {
1446
+ "text/plain": [
1447
+ "160"
1448
+ ]
1449
+ },
1450
+ "metadata": {},
1451
+ "execution_count": 44
1452
+ }
1453
+ ]
1454
+ },
1455
+ {
1456
+ "cell_type": "code",
1457
+ "source": [
1458
+ "# create 2 dictionary \n",
1459
+ "# dic1: maps the label name to an integer\n",
1460
+ "# dic2: maps the label id(integer) to a label name\n",
1461
+ "labels = emotions_df[\"train\"].features[\"label\"].names\n",
1462
+ "label2id, id2label = dict(), dict()\n",
1463
+ "for i, label in enumerate(labels):\n",
1464
+ " label2id[label] = str(i)\n",
1465
+ " id2label[str(i)] = label\n"
1466
+ ],
1467
+ "metadata": {
1468
+ "id": "DoqhAfVTR4Qs"
1469
+ },
1470
+ "execution_count": 45,
1471
+ "outputs": []
1472
+ },
1473
+ {
1474
+ "cell_type": "code",
1475
+ "source": [
1476
+ "label2id"
1477
+ ],
1478
+ "metadata": {
1479
+ "colab": {
1480
+ "base_uri": "https://localhost:8080/"
1481
+ },
1482
+ "id": "aRTpaEITR5UN",
1483
+ "outputId": "06001bae-a14d-47e2-8c1b-721e4e94748e"
1484
+ },
1485
+ "execution_count": 46,
1486
+ "outputs": [
1487
+ {
1488
+ "output_type": "execute_result",
1489
+ "data": {
1490
+ "text/plain": [
1491
+ "{'anger': '0',\n",
1492
+ " 'contempt': '1',\n",
1493
+ " 'disgust': '2',\n",
1494
+ " 'fear': '3',\n",
1495
+ " 'happy': '4',\n",
1496
+ " 'neutral': '5',\n",
1497
+ " 'sad': '6',\n",
1498
+ " 'surprise': '7'}"
1499
+ ]
1500
+ },
1501
+ "metadata": {},
1502
+ "execution_count": 46
1503
+ }
1504
+ ]
1505
+ },
1506
+ {
1507
+ "cell_type": "code",
1508
+ "source": [
1509
+ "id2label"
1510
+ ],
1511
+ "metadata": {
1512
+ "colab": {
1513
+ "base_uri": "https://localhost:8080/"
1514
+ },
1515
+ "id": "z1gyQ1ZZR5XV",
1516
+ "outputId": "191228fa-1b9e-4ac3-f9e3-a5028d37ff57"
1517
+ },
1518
+ "execution_count": 47,
1519
+ "outputs": [
1520
+ {
1521
+ "output_type": "execute_result",
1522
+ "data": {
1523
+ "text/plain": [
1524
+ "{'0': 'anger',\n",
1525
+ " '1': 'contempt',\n",
1526
+ " '2': 'disgust',\n",
1527
+ " '3': 'fear',\n",
1528
+ " '4': 'happy',\n",
1529
+ " '5': 'neutral',\n",
1530
+ " '6': 'sad',\n",
1531
+ " '7': 'surprise'}"
1532
+ ]
1533
+ },
1534
+ "metadata": {},
1535
+ "execution_count": 47
1536
+ }
1537
+ ]
1538
+ },
1539
+ {
1540
+ "cell_type": "code",
1541
+ "source": [
1542
+ "from transformers import AutoImageProcessor\n",
1543
+ "\n",
1544
+ "checkpoint = \"google/vit-base-patch16-224-in21k\"\n",
1545
+ "image_processor = AutoImageProcessor.from_pretrained(checkpoint)"
1546
+ ],
1547
+ "metadata": {
1548
+ "id": "QmVyt4p1R5a6"
1549
+ },
1550
+ "execution_count": 48,
1551
+ "outputs": []
1552
+ },
1553
+ {
1554
+ "cell_type": "code",
1555
+ "source": [],
1556
+ "metadata": {
1557
+ "id": "y3wZZw6QR5eU"
1558
+ },
1559
+ "execution_count": 48,
1560
+ "outputs": []
1561
+ },
1562
+ {
1563
+ "cell_type": "code",
1564
+ "source": [],
1565
+ "metadata": {
1566
+ "id": "npIDtsLgTROr"
1567
+ },
1568
+ "execution_count": 48,
1569
+ "outputs": []
1570
+ },
1571
+ {
1572
+ "cell_type": "code",
1573
+ "source": [
1574
+ "import numpy as np\n",
1575
+ "import tensorflow as tf\n",
1576
+ "from PIL import Image\n",
1577
+ "\n",
1578
+ "# convert image to a tensor\n",
1579
+ "def convert_to_tf_tensor(image: Image):\n",
1580
+ " np_image = np.array(image)\n",
1581
+ " tf_image = tf.convert_to_tensor(np_image)\n",
1582
+ " # `expand_dims()` is used to add a batch dimension since\n",
1583
+ " # the TF augmentation layers operates on batched inputs.\n",
1584
+ " return tf.expand_dims(tf_image, 0)\n",
1585
+ "\n",
1586
+ "\n",
1587
+ "def preprocess_train(example_batch):\n",
1588
+ " \"\"\"Apply train_transforms across a batch.\"\"\"\n",
1589
+ " images = [\n",
1590
+ " train_data_augmentation(convert_to_tf_tensor(image.convert(\"RGB\"))) for image in example_batch[\"image\"]\n",
1591
+ " ]\n",
1592
+ " example_batch[\"pixel_values\"] = [tf.transpose(tf.squeeze(image)) for image in images]\n",
1593
+ " return example_batch\n",
1594
+ "\n",
1595
+ "\n",
1596
+ "def preprocess_val(example_batch):\n",
1597
+ " \"\"\"Apply val_transforms across a batch.\"\"\"\n",
1598
+ " images = [\n",
1599
+ " val_data_augmentation(convert_to_tf_tensor(image.convert(\"RGB\"))) for image in example_batch[\"image\"]\n",
1600
+ " ]\n",
1601
+ " example_batch[\"pixel_values\"] = [tf.transpose(tf.squeeze(image)) for image in images]\n",
1602
+ " return example_batch"
1603
+ ],
1604
+ "metadata": {
1605
+ "id": "kWOEaQ8FRHzA"
1606
+ },
1607
+ "execution_count": 49,
1608
+ "outputs": []
1609
+ },
1610
+ {
1611
+ "cell_type": "code",
1612
+ "source": [],
1613
+ "metadata": {
1614
+ "id": "ma5JiYWITRRl"
1615
+ },
1616
+ "execution_count": 49,
1617
+ "outputs": []
1618
+ },
1619
+ {
1620
+ "cell_type": "code",
1621
+ "source": [
1622
+ "# apply transform to the training and testing dataset\n",
1623
+ "\n",
1624
+ "emotions_df[\"train\"].set_transform(preprocess_train)\n",
1625
+ "emotions_df[\"test\"].set_transform(preprocess_val)"
1626
+ ],
1627
+ "metadata": {
1628
+ "id": "UpWd7hc7RH3I"
1629
+ },
1630
+ "execution_count": 50,
1631
+ "outputs": []
1632
+ },
1633
+ {
1634
+ "cell_type": "code",
1635
+ "source": [
1636
+ "#create a batch of examples using DefaultDataCollator\n",
1637
+ "from transformers import DefaultDataCollator\n",
1638
+ "\n",
1639
+ "data_collator = DefaultDataCollator(return_tensors=\"tf\")"
1640
+ ],
1641
+ "metadata": {
1642
+ "id": "0zQOcaYBTRVA"
1643
+ },
1644
+ "execution_count": 51,
1645
+ "outputs": []
1646
+ },
1647
+ {
1648
+ "cell_type": "code",
1649
+ "source": [],
1650
+ "metadata": {
1651
+ "id": "zPYyzlsNTRfg"
1652
+ },
1653
+ "execution_count": 51,
1654
+ "outputs": []
1655
+ },
1656
+ {
1657
+ "cell_type": "code",
1658
+ "source": [
1659
+ "# evaluate accuracy\n",
1660
+ "import evaluate\n",
1661
+ "\n",
1662
+ "accuracy = evaluate.load(\"accuracy\")"
1663
+ ],
1664
+ "metadata": {
1665
+ "id": "fVaQvixOVVsz"
1666
+ },
1667
+ "execution_count": 52,
1668
+ "outputs": []
1669
+ },
1670
+ {
1671
+ "cell_type": "code",
1672
+ "source": [
1673
+ "import numpy as np\n",
1674
+ "\n",
1675
+ "def compute_metrics(eval_pred):\n",
1676
+ " predictions, labels = eval_pred\n",
1677
+ " predictions = np.argmax(predictions, axis=1)\n",
1678
+ " return accuracy.compute(predictions=predictions, references=labels)"
1679
+ ],
1680
+ "metadata": {
1681
+ "id": "nEj80b7FTseY"
1682
+ },
1683
+ "execution_count": 53,
1684
+ "outputs": []
1685
+ },
1686
+ {
1687
+ "cell_type": "code",
1688
+ "source": [],
1689
+ "metadata": {
1690
+ "id": "vn9G6JZ0Tsh4"
1691
+ },
1692
+ "execution_count": 53,
1693
+ "outputs": []
1694
+ },
1695
+ {
1696
+ "cell_type": "markdown",
1697
+ "source": [
1698
+ "TRAIN"
1699
+ ],
1700
+ "metadata": {
1701
+ "id": "LvDvoIFzUEk-"
1702
+ }
1703
+ },
1704
+ {
1705
+ "cell_type": "code",
1706
+ "source": [
1707
+ "from transformers import create_optimizer\n",
1708
+ "\n",
1709
+ "batch_size = 16\n",
1710
+ "num_epochs = 20\n",
1711
+ "num_train_steps = len(emotions_df[\"train\"]) * num_epochs\n",
1712
+ "learning_rate = 3e-4\n",
1713
+ "weight_decay_rate = 0.01\n",
1714
+ "\n",
1715
+ "optimizer, lr_schedule = create_optimizer(\n",
1716
+ " init_lr=learning_rate,\n",
1717
+ " num_train_steps=num_train_steps,\n",
1718
+ " weight_decay_rate=weight_decay_rate,\n",
1719
+ " num_warmup_steps=0,\n",
1720
+ ")"
1721
+ ],
1722
+ "metadata": {
1723
+ "id": "xGYIJKUHTskw"
1724
+ },
1725
+ "execution_count": 54,
1726
+ "outputs": []
1727
+ },
1728
+ {
1729
+ "cell_type": "code",
1730
+ "source": [],
1731
+ "metadata": {
1732
+ "id": "M3ZPsb9LTsoL"
1733
+ },
1734
+ "execution_count": 54,
1735
+ "outputs": []
1736
+ },
1737
+ {
1738
+ "cell_type": "code",
1739
+ "source": [
1740
+ "from transformers import TFAutoModelForImageClassification\n",
1741
+ "\n",
1742
+ "model = TFAutoModelForImageClassification.from_pretrained(\n",
1743
+ " checkpoint,\n",
1744
+ " id2label=id2label,\n",
1745
+ " label2id=label2id,\n",
1746
+ ")"
1747
+ ],
1748
+ "metadata": {
1749
+ "colab": {
1750
+ "base_uri": "https://localhost:8080/"
1751
+ },
1752
+ "id": "KABXS5tkfFM8",
1753
+ "outputId": "4e5cbbc5-4334-4e5d-f96e-84bed9153db3"
1754
+ },
1755
+ "execution_count": 55,
1756
+ "outputs": [
1757
+ {
1758
+ "output_type": "stream",
1759
+ "name": "stderr",
1760
+ "text": [
1761
+ "Some layers from the model checkpoint at google/vit-base-patch16-224-in21k were not used when initializing TFViTForImageClassification: ['vit/pooler/dense/kernel:0', 'vit/pooler/dense/bias:0']\n",
1762
+ "- This IS expected if you are initializing TFViTForImageClassification 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",
1763
+ "- This IS NOT expected if you are initializing TFViTForImageClassification from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n",
1764
+ "Some layers of TFViTForImageClassification were not initialized from the model checkpoint at google/vit-base-patch16-224-in21k and are newly initialized: ['classifier']\n",
1765
+ "You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n"
1766
+ ]
1767
+ }
1768
+ ]
1769
+ },
1770
+ {
1771
+ "cell_type": "code",
1772
+ "source": [],
1773
+ "metadata": {
1774
+ "id": "lZMOoitIUexL"
1775
+ },
1776
+ "execution_count": 55,
1777
+ "outputs": []
1778
+ },
1779
+ {
1780
+ "cell_type": "code",
1781
+ "source": [
1782
+ "# avoiding overfitting \n",
1783
+ "\n",
1784
+ "from tensorflow import keras\n",
1785
+ "from tensorflow.keras import layers\n",
1786
+ "\n",
1787
+ "size = (image_processor.size[\"height\"], image_processor.size[\"width\"])\n",
1788
+ "\n",
1789
+ "# Transformations for the training set\n",
1790
+ "# data augmentation to make the model more robust and to avoid overfitting\n",
1791
+ "train_data_augmentation = keras.Sequential(\n",
1792
+ " [\n",
1793
+ " layers.RandomCrop(size[0], size[1]),\n",
1794
+ " layers.Rescaling(scale=1.0 / 127.5, offset=-1),\n",
1795
+ " layers.RandomFlip(\"horizontal\"),\n",
1796
+ " layers.RandomRotation(factor=0.02),\n",
1797
+ " layers.RandomZoom(height_factor=0.2, width_factor=0.2),\n",
1798
+ " ],\n",
1799
+ " name=\"train_data_augmentation\",\n",
1800
+ ")\n",
1801
+ "\n",
1802
+ "# Transformations for the validation set\n",
1803
+ "val_data_augmentation = keras.Sequential(\n",
1804
+ " [\n",
1805
+ " layers.CenterCrop(size[0], size[1]),\n",
1806
+ " layers.Rescaling(scale=1.0 / 127.5, offset=-1),\n",
1807
+ " ],\n",
1808
+ " name=\"val_data_augmentation\",\n",
1809
+ ")"
1810
+ ],
1811
+ "metadata": {
1812
+ "id": "EtXaPaGCVE7e"
1813
+ },
1814
+ "execution_count": 56,
1815
+ "outputs": []
1816
+ },
1817
+ {
1818
+ "cell_type": "code",
1819
+ "source": [],
1820
+ "metadata": {
1821
+ "id": "4eKP4h7rVFNr"
1822
+ },
1823
+ "execution_count": 56,
1824
+ "outputs": []
1825
+ },
1826
+ {
1827
+ "cell_type": "code",
1828
+ "source": [
1829
+ "# converting our train dataset to tensor dataset (tf.data.Dataset)\n",
1830
+ "tf_train_dataset = emotions_df[\"train\"].to_tf_dataset(\n",
1831
+ " columns=\"pixel_values\", label_cols=\"label\", shuffle=True, batch_size=batch_size, collate_fn=data_collator\n",
1832
+ ")\n",
1833
+ "\n",
1834
+ "# converting our test dataset to tensor dataset (tf.data.Dataset)\n",
1835
+ "tf_eval_dataset = emotions_df[\"test\"].to_tf_dataset(\n",
1836
+ " columns=\"pixel_values\", label_cols=\"label\", shuffle=True, batch_size=batch_size, collate_fn=data_collator\n",
1837
+ ")"
1838
+ ],
1839
+ "metadata": {
1840
+ "id": "3j70Yv9dRH6t"
1841
+ },
1842
+ "execution_count": 57,
1843
+ "outputs": []
1844
+ },
1845
+ {
1846
+ "cell_type": "code",
1847
+ "source": [
1848
+ "from tensorflow.keras.losses import SparseCategoricalCrossentropy\n",
1849
+ "\n",
1850
+ "loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)\n",
1851
+ "model.compile(optimizer=optimizer, loss=loss)"
1852
+ ],
1853
+ "metadata": {
1854
+ "id": "iiDCBtU5UjqM"
1855
+ },
1856
+ "execution_count": 58,
1857
+ "outputs": []
1858
+ },
1859
+ {
1860
+ "cell_type": "code",
1861
+ "source": [
1862
+ "from transformers.keras_callbacks import KerasMetricCallback, PushToHubCallback\n",
1863
+ "\n",
1864
+ "metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_eval_dataset)\n",
1865
+ "push_to_hub_callback = PushToHubCallback(\n",
1866
+ " output_dir=\"emotions_classifier\",\n",
1867
+ " tokenizer=image_processor,\n",
1868
+ " save_strategy=\"no\",\n",
1869
+ ")\n",
1870
+ "callbacks = [metric_callback, push_to_hub_callback]"
1871
+ ],
1872
+ "metadata": {
1873
+ "colab": {
1874
+ "base_uri": "https://localhost:8080/"
1875
+ },
1876
+ "id": "kt3kPnOkUjuG",
1877
+ "outputId": "ceb5b9e9-768b-46ea-8df1-45022649b6f4"
1878
+ },
1879
+ "execution_count": 59,
1880
+ "outputs": [
1881
+ {
1882
+ "output_type": "stream",
1883
+ "name": "stderr",
1884
+ "text": [
1885
+ "/content/emotions_classifier is already a clone of https://huggingface.co/CynthiaCR/emotions_classifier. Make sure you pull the latest changes with `repo.git_pull()`.\n",
1886
+ "WARNING:huggingface_hub.repository:/content/emotions_classifier is already a clone of https://huggingface.co/CynthiaCR/emotions_classifier. Make sure you pull the latest changes with `repo.git_pull()`.\n"
1887
+ ]
1888
+ }
1889
+ ]
1890
+ },
1891
+ {
1892
+ "cell_type": "code",
1893
+ "source": [
1894
+ "model.fit(tf_train_dataset, validation_data=tf_eval_dataset, epochs=num_epochs, callbacks=callbacks)"
1895
+ ],
1896
+ "metadata": {
1897
+ "colab": {
1898
+ "base_uri": "https://localhost:8080/",
1899
+ "height": 920,
1900
+ "referenced_widgets": [
1901
+ "a965aa730e164b249ff040457c944d94",
1902
+ "cdefc2d658bc4bd3ba8b3b4d0affd263",
1903
+ "f41f320a42c54f90996b54af83689aff",
1904
+ "833a251db60140a598b9b4d28583271b",
1905
+ "b157a9c50b834c24acc1445c803c670c",
1906
+ "64deb634ee7249ad8ed9bd93c1979459",
1907
+ "b41049a008604c1ab7bdb4646092628d",
1908
+ "6d971fa517aa4c1295522279f29f0258",
1909
+ "4f316fbfcf3644cd84a3f146265c9ba2",
1910
+ "06067b563aa54cc386e4954a9702042f",
1911
+ "e2dca77a089e43caa918174707165b56"
1912
+ ]
1913
+ },
1914
+ "id": "k1m8BvqxVt-t",
1915
+ "outputId": "2594dd93-d133-4ae0-c4c9-50460962540e"
1916
+ },
1917
+ "execution_count": 60,
1918
+ "outputs": [
1919
+ {
1920
+ "output_type": "stream",
1921
+ "name": "stdout",
1922
+ "text": [
1923
+ "Epoch 1/20\n",
1924
+ "40/40 [==============================] - 69s 1s/step - loss: 2.0363 - val_loss: 2.0960 - accuracy: 0.1000\n",
1925
+ "Epoch 2/20\n",
1926
+ "40/40 [==============================] - 47s 1s/step - loss: 2.0822 - val_loss: 2.1254 - accuracy: 0.0813\n",
1927
+ "Epoch 3/20\n",
1928
+ "40/40 [==============================] - 47s 1s/step - loss: 1.9916 - val_loss: 1.9392 - accuracy: 0.2062\n",
1929
+ "Epoch 4/20\n",
1930
+ "40/40 [==============================] - 47s 1s/step - loss: 1.9223 - val_loss: 1.8385 - accuracy: 0.1688\n",
1931
+ "Epoch 5/20\n",
1932
+ "40/40 [==============================] - 48s 1s/step - loss: 1.8213 - val_loss: 1.7294 - accuracy: 0.2313\n",
1933
+ "Epoch 6/20\n",
1934
+ "40/40 [==============================] - 48s 1s/step - loss: 1.6940 - val_loss: 1.6953 - accuracy: 0.2625\n",
1935
+ "Epoch 7/20\n",
1936
+ "40/40 [==============================] - 48s 1s/step - loss: 1.7153 - val_loss: 1.6009 - accuracy: 0.3187\n",
1937
+ "Epoch 8/20\n",
1938
+ "40/40 [==============================] - 48s 1s/step - loss: 1.5788 - val_loss: 1.6385 - accuracy: 0.2750\n",
1939
+ "Epoch 9/20\n",
1940
+ "40/40 [==============================] - 48s 1s/step - loss: 1.5359 - val_loss: 1.5635 - accuracy: 0.3438\n",
1941
+ "Epoch 10/20\n",
1942
+ "40/40 [==============================] - 48s 1s/step - loss: 1.4768 - val_loss: 1.6180 - accuracy: 0.3250\n",
1943
+ "Epoch 11/20\n",
1944
+ "40/40 [==============================] - 50s 1s/step - loss: 1.4746 - val_loss: 1.6063 - accuracy: 0.3125\n",
1945
+ "Epoch 12/20\n",
1946
+ "40/40 [==============================] - 48s 1s/step - loss: 1.5163 - val_loss: 1.5641 - accuracy: 0.3625\n",
1947
+ "Epoch 13/20\n",
1948
+ "40/40 [==============================] - 48s 1s/step - loss: 1.4692 - val_loss: 1.5722 - accuracy: 0.3063\n",
1949
+ "Epoch 14/20\n",
1950
+ "40/40 [==============================] - 50s 1s/step - loss: 1.4468 - val_loss: 1.7363 - accuracy: 0.3500\n",
1951
+ "Epoch 15/20\n",
1952
+ "40/40 [==============================] - 48s 1s/step - loss: 1.7116 - val_loss: 1.7531 - accuracy: 0.2687\n",
1953
+ "Epoch 16/20\n",
1954
+ "40/40 [==============================] - 48s 1s/step - loss: 1.5334 - val_loss: 1.5908 - accuracy: 0.2562\n",
1955
+ "Epoch 17/20\n",
1956
+ "40/40 [==============================] - 48s 1s/step - loss: 1.4988 - val_loss: 1.5169 - accuracy: 0.3312\n",
1957
+ "Epoch 18/20\n",
1958
+ "40/40 [==============================] - 48s 1s/step - loss: 1.4605 - val_loss: 1.5041 - accuracy: 0.2812\n",
1959
+ "Epoch 19/20\n",
1960
+ "40/40 [==============================] - 48s 1s/step - loss: 1.3545 - val_loss: 1.4824 - accuracy: 0.3187\n",
1961
+ "Epoch 20/20\n",
1962
+ "40/40 [==============================] - 48s 1s/step - loss: 1.3846 - val_loss: 1.6122 - accuracy: 0.2687\n"
1963
+ ]
1964
+ },
1965
+ {
1966
+ "output_type": "display_data",
1967
+ "data": {
1968
+ "text/plain": [
1969
+ "Upload file tf_model.h5: 0%| | 1.00/328M [00:00<?, ?B/s]"
1970
+ ],
1971
+ "application/vnd.jupyter.widget-view+json": {
1972
+ "version_major": 2,
1973
+ "version_minor": 0,
1974
+ "model_id": "a965aa730e164b249ff040457c944d94"
1975
+ }
1976
+ },
1977
+ "metadata": {}
1978
+ },
1979
+ {
1980
+ "output_type": "stream",
1981
+ "name": "stderr",
1982
+ "text": [
1983
+ "To https://huggingface.co/CynthiaCR/emotions_classifier\n",
1984
+ " 6794f2e..9552b39 main -> main\n",
1985
+ "\n",
1986
+ "WARNING:huggingface_hub.repository:To https://huggingface.co/CynthiaCR/emotions_classifier\n",
1987
+ " 6794f2e..9552b39 main -> main\n",
1988
+ "\n"
1989
+ ]
1990
+ },
1991
+ {
1992
+ "output_type": "execute_result",
1993
+ "data": {
1994
+ "text/plain": [
1995
+ "<keras.callbacks.History at 0x7f131a6aae60>"
1996
+ ]
1997
+ },
1998
+ "metadata": {},
1999
+ "execution_count": 60
2000
+ }
2001
+ ]
2002
+ },
2003
+ {
2004
+ "cell_type": "markdown",
2005
+ "source": [
2006
+ "Prediction"
2007
+ ],
2008
+ "metadata": {
2009
+ "id": "29ZPkramjcir"
2010
+ }
2011
+ },
2012
+ {
2013
+ "cell_type": "code",
2014
+ "source": [],
2015
+ "metadata": {
2016
+ "id": "C_9-dH4cVuEB"
2017
+ },
2018
+ "execution_count": 60,
2019
+ "outputs": []
2020
+ },
2021
+ {
2022
+ "cell_type": "code",
2023
+ "source": [
2024
+ "ds = load_dataset(\"FastJobs/Visual_Emotional_Analysis\", split=\"train[:10]\")\n",
2025
+ "ds"
2026
+ ],
2027
+ "metadata": {
2028
+ "id": "JUFTj8TYiBwS",
2029
+ "colab": {
2030
+ "base_uri": "https://localhost:8080/"
2031
+ },
2032
+ "outputId": "c22db2f0-0443-4aa9-9346-739967bb43b8"
2033
+ },
2034
+ "execution_count": 61,
2035
+ "outputs": [
2036
+ {
2037
+ "output_type": "stream",
2038
+ "name": "stderr",
2039
+ "text": [
2040
+ "WARNING:datasets.builder:Found cached dataset imagefolder (/root/.cache/huggingface/datasets/FastJobs___imagefolder/FastJobs--Visual_Emotional_Analysis-bbb0f5e70847fc91/0.0.0/37fbb85cc714a338bea574ac6c7d0b5be5aff46c1862c1989b20e0771199e93f)\n"
2041
+ ]
2042
+ },
2043
+ {
2044
+ "output_type": "execute_result",
2045
+ "data": {
2046
+ "text/plain": [
2047
+ "Dataset({\n",
2048
+ " features: ['image', 'label'],\n",
2049
+ " num_rows: 10\n",
2050
+ "})"
2051
+ ]
2052
+ },
2053
+ "metadata": {},
2054
+ "execution_count": 61
2055
+ }
2056
+ ]
2057
+ },
2058
+ {
2059
+ "cell_type": "code",
2060
+ "source": [
2061
+ "image = ds[\"image\"][0]"
2062
+ ],
2063
+ "metadata": {
2064
+ "id": "WBXiMJ48qBKl"
2065
+ },
2066
+ "execution_count": 62,
2067
+ "outputs": []
2068
+ },
2069
+ {
2070
+ "cell_type": "code",
2071
+ "source": [
2072
+ "from transformers import pipeline\n",
2073
+ "\n",
2074
+ "classifier = pipeline(\"image-classification\", model=\"CynthiaCR/emotions_classifier\")\n",
2075
+ "classifier(image)"
2076
+ ],
2077
+ "metadata": {
2078
+ "colab": {
2079
+ "base_uri": "https://localhost:8080/",
2080
+ "height": 232,
2081
+ "referenced_widgets": [
2082
+ "75599d75d500474db4e9ca8801af0ac6",
2083
+ "5d8c864d082047b2a3b180985ae0b698",
2084
+ "502dd70810054869bb01aae69ab2431d",
2085
+ "53ff5a46800543d7a2e6ed532e0085eb",
2086
+ "8a3110bdb7844528a867a3f2d0daf028",
2087
+ "dbceb3e2a8b144bd8a899e7778b9fb67",
2088
+ "dc6982a803d34c2b9366323f44cf0ef7",
2089
+ "e4fa00ecdf7e4878bd07e3e81d22f7b0",
2090
+ "708979e23d1f4833b31b5c8f8c208cb4",
2091
+ "d0432428e4524f318bff7ccf2f91c6b4",
2092
+ "25a5031e71144bf4bec62694c16f39e2"
2093
+ ]
2094
+ },
2095
+ "id": "QkaFEJg2Ujxl",
2096
+ "outputId": "5ed6475b-9d54-48b8-b175-a16e39341a1d"
2097
+ },
2098
+ "execution_count": 63,
2099
+ "outputs": [
2100
+ {
2101
+ "output_type": "display_data",
2102
+ "data": {
2103
+ "text/plain": [
2104
+ "Downloading tf_model.h5: 0%| | 0.00/344M [00:00<?, ?B/s]"
2105
+ ],
2106
+ "application/vnd.jupyter.widget-view+json": {
2107
+ "version_major": 2,
2108
+ "version_minor": 0,
2109
+ "model_id": "75599d75d500474db4e9ca8801af0ac6"
2110
+ }
2111
+ },
2112
+ "metadata": {}
2113
+ },
2114
+ {
2115
+ "output_type": "stream",
2116
+ "name": "stderr",
2117
+ "text": [
2118
+ "All model checkpoint layers were used when initializing TFViTForImageClassification.\n",
2119
+ "\n",
2120
+ "All the layers of TFViTForImageClassification were initialized from the model checkpoint at CynthiaCR/emotions_classifier.\n",
2121
+ "If your task is similar to the task the model of the checkpoint was trained on, you can already use TFViTForImageClassification for predictions without further training.\n"
2122
+ ]
2123
+ },
2124
+ {
2125
+ "output_type": "execute_result",
2126
+ "data": {
2127
+ "text/plain": [
2128
+ "[{'score': 0.32123512029647827, 'label': 'fear'},\n",
2129
+ " {'score': 0.31210750341415405, 'label': 'sad'},\n",
2130
+ " {'score': 0.1644315868616104, 'label': 'anger'},\n",
2131
+ " {'score': 0.10217338800430298, 'label': 'disgust'},\n",
2132
+ " {'score': 0.04358164221048355, 'label': 'contempt'}]"
2133
+ ]
2134
+ },
2135
+ "metadata": {},
2136
+ "execution_count": 63
2137
+ }
2138
+ ]
2139
+ },
2140
+ {
2141
+ "cell_type": "code",
2142
+ "source": [
2143
+ "from transformers import AutoImageProcessor\n",
2144
+ "\n",
2145
+ "image_processor = AutoImageProcessor.from_pretrained(\"CynthiaCR/emotions_classifier\")\n",
2146
+ "inputs = image_processor(image, return_tensors=\"tf\")"
2147
+ ],
2148
+ "metadata": {
2149
+ "id": "0vbEKCwX0ybE"
2150
+ },
2151
+ "execution_count": 64,
2152
+ "outputs": []
2153
+ },
2154
+ {
2155
+ "cell_type": "code",
2156
+ "source": [],
2157
+ "metadata": {
2158
+ "id": "sqhjJ_9jkdgl"
2159
+ },
2160
+ "execution_count": 64,
2161
+ "outputs": []
2162
+ },
2163
+ {
2164
+ "cell_type": "code",
2165
+ "source": [
2166
+ "from transformers import TFAutoModelForImageClassification\n",
2167
+ "\n",
2168
+ "model = TFAutoModelForImageClassification.from_pretrained(\"CynthiaCR/emotions_classifier\")\n",
2169
+ "logits = model(**inputs).logits"
2170
+ ],
2171
+ "metadata": {
2172
+ "id": "iCMCASWf0yew",
2173
+ "colab": {
2174
+ "base_uri": "https://localhost:8080/"
2175
+ },
2176
+ "outputId": "6f38799c-8478-4b6f-fba3-0beaa95ed8f5"
2177
+ },
2178
+ "execution_count": 65,
2179
+ "outputs": [
2180
+ {
2181
+ "output_type": "stream",
2182
+ "name": "stderr",
2183
+ "text": [
2184
+ "All model checkpoint layers were used when initializing TFViTForImageClassification.\n",
2185
+ "\n",
2186
+ "All the layers of TFViTForImageClassification were initialized from the model checkpoint at CynthiaCR/emotions_classifier.\n",
2187
+ "If your task is similar to the task the model of the checkpoint was trained on, you can already use TFViTForImageClassification for predictions without further training.\n"
2188
+ ]
2189
+ }
2190
+ ]
2191
+ },
2192
+ {
2193
+ "cell_type": "code",
2194
+ "source": [],
2195
+ "metadata": {
2196
+ "id": "7iSRY48Gkdti"
2197
+ },
2198
+ "execution_count": 65,
2199
+ "outputs": []
2200
+ },
2201
+ {
2202
+ "cell_type": "code",
2203
+ "source": [
2204
+ "predicted_class_id = int(tf.math.argmax(logits, axis=-1)[0])\n",
2205
+ "model.config.id2label[predicted_class_id]"
2206
+ ],
2207
+ "metadata": {
2208
+ "id": "pJUFDX_e0yh9",
2209
+ "colab": {
2210
+ "base_uri": "https://localhost:8080/",
2211
+ "height": 36
2212
+ },
2213
+ "outputId": "c09c9df5-41d8-418e-a44c-0cab27fe28e1"
2214
+ },
2215
+ "execution_count": 66,
2216
+ "outputs": [
2217
+ {
2218
+ "output_type": "execute_result",
2219
+ "data": {
2220
+ "text/plain": [
2221
+ "'fear'"
2222
+ ],
2223
+ "application/vnd.google.colaboratory.intrinsic+json": {
2224
+ "type": "string"
2225
+ }
2226
+ },
2227
+ "metadata": {},
2228
+ "execution_count": 66
2229
+ }
2230
+ ]
2231
+ }
2232
+ ]
2233
+ }