File size: 23,494 Bytes
36de64c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "a8bd8621-65ae-4cb2-bdac-12c3b97a0de5",
   "metadata": {},
   "source": [
    "As of 24.3.18 the way to export cells to a python script is:\n",
    "1) pip install nbdev\n",
    "2) Add \"#|default_exp [file_name]\" to the top of your notebook\n",
    "3) Add \"#|export\" to the top of each cell you want to export\n",
    "4) run:\n",
    "    import nbdev\n",
    "    # the 2nd arg ('.') means \"save to the root directory where your .ipynb is\"\n",
    "    nbdev.export.nb_export('[notebook_name].ipynb','.') "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "533b4754-10d9-44bc-9894-a50523aec091",
   "metadata": {},
   "outputs": [],
   "source": [
    "#|default_exp main"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "a090bf5f-9cd5-4f70-a7c0-42ad8db68db4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33mDEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621\u001b[0m\u001b[33m\n",
      "\u001b[0mRequirement already satisfied: nbdev in /usr/local/lib/python3.9/site-packages (2.3.13)\n",
      "Requirement already satisfied: ipywidgets<=8.0.4 in /usr/local/lib/python3.9/site-packages (from nbdev) (8.0.4)\n",
      "Requirement already satisfied: fastcore>=1.5.27 in /usr/local/lib/python3.9/site-packages (from nbdev) (1.5.29)\n",
      "Requirement already satisfied: execnb>=0.1.4 in /usr/local/lib/python3.9/site-packages (from nbdev) (0.1.5)\n",
      "Requirement already satisfied: astunparse in /usr/local/lib/python3.9/site-packages (from nbdev) (1.6.3)\n",
      "Requirement already satisfied: ghapi>=1.0.3 in /usr/local/lib/python3.9/site-packages (from nbdev) (1.0.4)\n",
      "Requirement already satisfied: watchdog in /usr/local/lib/python3.9/site-packages (from nbdev) (4.0.0)\n",
      "Requirement already satisfied: asttokens in /usr/local/lib/python3.9/site-packages (from nbdev) (2.4.1)\n",
      "Requirement already satisfied: PyYAML in /usr/local/lib/python3.9/site-packages (from nbdev) (6.0.1)\n",
      "Requirement already satisfied: ipython in /usr/local/lib/python3.9/site-packages (from execnb>=0.1.4->nbdev) (8.18.1)\n",
      "Requirement already satisfied: pip in /usr/local/lib/python3.9/site-packages (from fastcore>=1.5.27->nbdev) (24.0)\n",
      "Requirement already satisfied: packaging in /usr/local/lib/python3.9/site-packages (from fastcore>=1.5.27->nbdev) (23.0)\n",
      "Requirement already satisfied: ipykernel>=4.5.1 in /usr/local/lib/python3.9/site-packages (from ipywidgets<=8.0.4->nbdev) (6.29.3)\n",
      "Requirement already satisfied: traitlets>=4.3.1 in /usr/local/lib/python3.9/site-packages (from ipywidgets<=8.0.4->nbdev) (5.14.2)\n",
      "Requirement already satisfied: widgetsnbextension~=4.0 in /usr/local/lib/python3.9/site-packages (from ipywidgets<=8.0.4->nbdev) (4.0.10)\n",
      "Requirement already satisfied: jupyterlab-widgets~=3.0 in /usr/local/lib/python3.9/site-packages (from ipywidgets<=8.0.4->nbdev) (3.0.10)\n",
      "Requirement already satisfied: six>=1.12.0 in /usr/local/lib/python3.9/site-packages (from asttokens->nbdev) (1.16.0)\n",
      "Requirement already satisfied: wheel<1.0,>=0.23.0 in /usr/local/lib/python3.9/site-packages (from astunparse->nbdev) (0.41.3)\n",
      "Requirement already satisfied: appnope in /usr/local/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<=8.0.4->nbdev) (0.1.4)\n",
      "Requirement already satisfied: comm>=0.1.1 in /usr/local/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<=8.0.4->nbdev) (0.2.2)\n",
      "Requirement already satisfied: debugpy>=1.6.5 in /usr/local/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<=8.0.4->nbdev) (1.8.1)\n",
      "Requirement already satisfied: jupyter-client>=6.1.12 in /usr/local/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<=8.0.4->nbdev) (8.6.1)\n",
      "Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in /usr/local/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<=8.0.4->nbdev) (5.7.2)\n",
      "Requirement already satisfied: matplotlib-inline>=0.1 in /usr/local/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<=8.0.4->nbdev) (0.1.6)\n",
      "Requirement already satisfied: nest-asyncio in /usr/local/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<=8.0.4->nbdev) (1.6.0)\n",
      "Requirement already satisfied: psutil in /usr/local/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<=8.0.4->nbdev) (5.9.8)\n",
      "Requirement already satisfied: pyzmq>=24 in /usr/local/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<=8.0.4->nbdev) (25.1.2)\n",
      "Requirement already satisfied: tornado>=6.1 in /usr/local/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<=8.0.4->nbdev) (6.4)\n",
      "Requirement already satisfied: decorator in /usr/local/lib/python3.9/site-packages (from ipython->execnb>=0.1.4->nbdev) (5.1.1)\n",
      "Requirement already satisfied: jedi>=0.16 in /usr/local/lib/python3.9/site-packages (from ipython->execnb>=0.1.4->nbdev) (0.19.1)\n",
      "Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in /usr/local/lib/python3.9/site-packages (from ipython->execnb>=0.1.4->nbdev) (3.0.43)\n",
      "Requirement already satisfied: pygments>=2.4.0 in /usr/local/lib/python3.9/site-packages (from ipython->execnb>=0.1.4->nbdev) (2.17.2)\n",
      "Requirement already satisfied: stack-data in /usr/local/lib/python3.9/site-packages (from ipython->execnb>=0.1.4->nbdev) (0.6.3)\n",
      "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.9/site-packages (from ipython->execnb>=0.1.4->nbdev) (4.5.0)\n",
      "Requirement already satisfied: exceptiongroup in /usr/local/lib/python3.9/site-packages (from ipython->execnb>=0.1.4->nbdev) (1.2.0)\n",
      "Requirement already satisfied: pexpect>4.3 in /usr/local/lib/python3.9/site-packages (from ipython->execnb>=0.1.4->nbdev) (4.9.0)\n",
      "Requirement already satisfied: parso<0.9.0,>=0.8.3 in /usr/local/lib/python3.9/site-packages (from jedi>=0.16->ipython->execnb>=0.1.4->nbdev) (0.8.3)\n",
      "Requirement already satisfied: importlib-metadata>=4.8.3 in /usr/local/lib/python3.9/site-packages (from jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<=8.0.4->nbdev) (6.8.0)\n",
      "Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.9/site-packages (from jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<=8.0.4->nbdev) (2.8.2)\n",
      "Requirement already satisfied: platformdirs>=2.5 in /usr/local/lib/python3.9/site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel>=4.5.1->ipywidgets<=8.0.4->nbdev) (3.1.1)\n",
      "Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.9/site-packages (from pexpect>4.3->ipython->execnb>=0.1.4->nbdev) (0.7.0)\n",
      "Requirement already satisfied: wcwidth in /usr/local/lib/python3.9/site-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython->execnb>=0.1.4->nbdev) (0.2.13)\n",
      "Requirement already satisfied: executing>=1.2.0 in /usr/local/lib/python3.9/site-packages (from stack-data->ipython->execnb>=0.1.4->nbdev) (2.0.1)\n",
      "Requirement already satisfied: pure-eval in /usr/local/lib/python3.9/site-packages (from stack-data->ipython->execnb>=0.1.4->nbdev) (0.2.2)\n",
      "Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.9/site-packages (from importlib-metadata>=4.8.3->jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets<=8.0.4->nbdev) (3.17.0)\n",
      "\u001b[33mDEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621\u001b[0m\u001b[33m\n",
      "\u001b[0mNote: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "pip install nbdev"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "d5b7b2d4-9cec-4227-9e85-53612e3022f1",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'mx' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[6], line 2\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;66;03m#|export\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m y \u001b[38;5;241m=\u001b[39m \u001b[43mmx\u001b[49m\n",
      "\u001b[0;31mNameError\u001b[0m: name 'mx' is not defined"
     ]
    }
   ],
   "source": [
    "#|export\n",
    "y = mx"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "157f4ba8",
   "metadata": {
    "jp-MarkdownHeadingCollapsed": true
   },
   "source": [
    "# section header"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "c5ca1b5b-3360-40f7-99ff-afde86356275",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'bc' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[9], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m a \u001b[38;5;241m=\u001b[39m \u001b[43mbc\u001b[49m\n",
      "\u001b[0;31mNameError\u001b[0m: name 'bc' is not defined"
     ]
    }
   ],
   "source": [
    "a = bc"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "91656ffe-8347-4dcd-8c1f-92019f568dbe",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'ou3' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[49], line 2\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;66;03m#|export\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m i \u001b[38;5;241m=\u001b[39m \u001b[43mou3\u001b[49m\n",
      "\u001b[0;31mNameError\u001b[0m: name 'ou3' is not defined"
     ]
    }
   ],
   "source": [
    "#|export\n",
    "i = ou"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "d09eb6cc-b7cf-4009-a13c-5df933469b96",
   "metadata": {},
   "outputs": [],
   "source": [
    "import nbdev\n",
    "\n",
    "notebook_name = \"lesson_2.ipynb\"\n",
    "export_destination = \".\" # the root directory\n",
    "nbdev.export.nb_export(notebook_name, export_destination)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6f087d39-106b-46a2-8623-f4429e2885f1",
   "metadata": {},
   "source": [
    "# section 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "20461ad3-4fb0-44a0-946c-28fb9e06f59e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Package                           Version\n",
      "--------------------------------- --------------\n",
      "absl-py                           2.0.0\n",
      "anyio                             4.3.0\n",
      "appnope                           0.1.4\n",
      "argon2-cffi                       23.1.0\n",
      "argon2-cffi-bindings              21.2.0\n",
      "arrow                             1.3.0\n",
      "asttokens                         2.4.1\n",
      "astunparse                        1.6.3\n",
      "async-lru                         2.0.4\n",
      "attrs                             23.2.0\n",
      "Babel                             2.14.0\n",
      "beautifulsoup4                    4.12.3\n",
      "black                             23.1.0\n",
      "bleach                            6.1.0\n",
      "blinker                           1.7.0\n",
      "cachetools                        5.3.2\n",
      "certifi                           2023.11.17\n",
      "cffi                              1.16.0\n",
      "charset-normalizer                3.3.2\n",
      "click                             8.1.3\n",
      "comm                              0.2.2\n",
      "debugpy                           1.8.1\n",
      "decorator                         5.1.1\n",
      "defusedxml                        0.7.1\n",
      "exceptiongroup                    1.2.0\n",
      "execnb                            0.1.5\n",
      "executing                         2.0.1\n",
      "fastcore                          1.5.29\n",
      "fastjsonschema                    2.19.1\n",
      "filelock                          3.13.1\n",
      "Flask                             3.0.0\n",
      "flatbuffers                       23.5.26\n",
      "fqdn                              1.5.1\n",
      "fsspec                            2024.2.0\n",
      "gast                              0.5.4\n",
      "ghapi                             1.0.4\n",
      "google-auth                       2.23.4\n",
      "google-auth-oauthlib              1.1.0\n",
      "google-pasta                      0.2.0\n",
      "grpcio                            1.59.3\n",
      "h11                               0.14.0\n",
      "h5py                              3.10.0\n",
      "httpcore                          1.0.4\n",
      "httpx                             0.27.0\n",
      "huggingface-hub                   0.20.3\n",
      "idna                              3.6\n",
      "importlib-metadata                6.8.0\n",
      "ipykernel                         6.29.3\n",
      "ipython                           8.18.1\n",
      "ipython-genutils                  0.2.0\n",
      "ipywidgets                        8.0.4\n",
      "isoduration                       20.11.0\n",
      "itsdangerous                      2.1.2\n",
      "jedi                              0.19.1\n",
      "Jinja2                            3.1.2\n",
      "joblib                            1.3.2\n",
      "json5                             0.9.24\n",
      "jsonpointer                       2.4\n",
      "jsonschema                        4.21.1\n",
      "jsonschema-specifications         2023.12.1\n",
      "jupyter                           1.0.0\n",
      "jupyter_client                    8.6.1\n",
      "jupyter-console                   6.6.3\n",
      "jupyter-contrib-core              0.4.2\n",
      "jupyter-contrib-nbextensions      0.7.0\n",
      "jupyter_core                      5.7.2\n",
      "jupyter-events                    0.9.1\n",
      "jupyter-highlight-selected-word   0.2.0\n",
      "jupyter-lsp                       2.2.4\n",
      "jupyter-nbextensions-configurator 0.6.3\n",
      "jupyter_server                    2.13.0\n",
      "jupyter_server_terminals          0.5.3\n",
      "jupyterlab                        4.1.5\n",
      "jupyterlab_pygments               0.3.0\n",
      "jupyterlab_server                 2.25.4\n",
      "jupyterlab_widgets                3.0.10\n",
      "kaggle                            1.6.6\n",
      "keras                             2.15.0\n",
      "libclang                          16.0.6\n",
      "lxml                              5.1.0\n",
      "Markdown                          3.5.1\n",
      "MarkupSafe                        2.1.3\n",
      "matplotlib-inline                 0.1.6\n",
      "mistune                           3.0.2\n",
      "ml-dtypes                         0.2.0\n",
      "mypy-extensions                   1.0.0\n",
      "nbclient                          0.10.0\n",
      "nbconvert                         7.16.2\n",
      "nbdev                             2.3.13\n",
      "nbformat                          5.10.3\n",
      "nest-asyncio                      1.6.0\n",
      "notebook                          7.1.2\n",
      "notebook_shim                     0.2.4\n",
      "numpy                             1.26.2\n",
      "oauthlib                          3.2.2\n",
      "opencv-python                     4.9.0.80\n",
      "opt-einsum                        3.3.0\n",
      "overrides                         7.7.0\n",
      "packaging                         23.0\n",
      "pandocfilters                     1.5.1\n",
      "parso                             0.8.3\n",
      "pathspec                          0.11.1\n",
      "pexpect                           4.9.0\n",
      "pip                               24.0\n",
      "platformdirs                      3.1.1\n",
      "prometheus_client                 0.20.0\n",
      "prompt-toolkit                    3.0.43\n",
      "protobuf                          4.23.4\n",
      "psutil                            5.9.8\n",
      "ptyprocess                        0.7.0\n",
      "pure-eval                         0.2.2\n",
      "pyasn1                            0.5.1\n",
      "pyasn1-modules                    0.3.0\n",
      "pycparser                         2.21\n",
      "pydot                             1.4.2\n",
      "Pygments                          2.17.2\n",
      "pyparsing                         3.1.1\n",
      "python-dateutil                   2.8.2\n",
      "python-json-logger                2.0.7\n",
      "python-slugify                    8.0.4\n",
      "PyYAML                            6.0.1\n",
      "pyzmq                             25.1.2\n",
      "qtconsole                         5.5.1\n",
      "QtPy                              2.4.1\n",
      "referencing                       0.34.0\n",
      "requests                          2.31.0\n",
      "requests-oauthlib                 1.3.1\n",
      "rfc3339-validator                 0.1.4\n",
      "rfc3986-validator                 0.1.1\n",
      "rpds-py                           0.18.0\n",
      "rsa                               4.9\n",
      "scikit-learn                      1.3.2\n",
      "scipy                             1.11.4\n",
      "Send2Trash                        1.8.2\n",
      "setuptools                        68.2.2\n",
      "simpleai                          0.8.3\n",
      "six                               1.16.0\n",
      "sniffio                           1.3.1\n",
      "soupsieve                         2.5\n",
      "stack-data                        0.6.3\n",
      "tensorboard                       2.15.1\n",
      "tensorboard-data-server           0.7.2\n",
      "tensorflow                        2.15.0\n",
      "tensorflow-estimator              2.15.0\n",
      "tensorflow-io-gcs-filesystem      0.34.0\n",
      "termcolor                         2.3.0\n",
      "terminado                         0.18.1\n",
      "text-unidecode                    1.3\n",
      "threadpoolctl                     3.2.0\n",
      "tinycss2                          1.2.1\n",
      "tomli                             2.0.1\n",
      "tornado                           6.4\n",
      "tqdm                              4.66.2\n",
      "traitlets                         5.14.2\n",
      "types-python-dateutil             2.9.0.20240316\n",
      "typing_extensions                 4.5.0\n",
      "uri-template                      1.3.0\n",
      "urllib3                           2.1.0\n",
      "watchdog                          4.0.0\n",
      "wcwidth                           0.2.13\n",
      "webcolors                         1.13\n",
      "webencodings                      0.5.1\n",
      "websocket-client                  1.7.0\n",
      "Werkzeug                          3.0.1\n",
      "wheel                             0.41.3\n",
      "widgetsnbextension                4.0.10\n",
      "wrapt                             1.14.1\n",
      "zipp                              3.17.0\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "pip list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "746c335b-5825-4032-9ee9-834d947ba01d",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'untar_data' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[8], line 2\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mfastcore\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mall\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n\u001b[0;32m----> 2\u001b[0m path \u001b[38;5;241m=\u001b[39m \u001b[43muntar_data\u001b[49m(URLs\u001b[38;5;241m.\u001b[39mPETS)\n\u001b[1;32m      3\u001b[0m dls \u001b[38;5;241m=\u001b[39m ImageDataLoaders\u001b[38;5;241m.\u001b[39mfrom_name_re(path, get_image_files(path\u001b[38;5;241m/\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mimages\u001b[39m\u001b[38;5;124m'\u001b[39m), pat\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m(.+)_\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124md+.jpg\u001b[39m\u001b[38;5;124m'\u001b[39m, item_tfms\u001b[38;5;241m=\u001b[39mResize(\u001b[38;5;241m460\u001b[39m), batch_tfms\u001b[38;5;241m=\u001b[39maug_transforms(size\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m224\u001b[39m, min_scale\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m0.75\u001b[39m))\n\u001b[1;32m      4\u001b[0m learn \u001b[38;5;241m=\u001b[39m vision_learner(dls, models\u001b[38;5;241m.\u001b[39mresnet50, metrics\u001b[38;5;241m=\u001b[39maccuracy)\n",
      "\u001b[0;31mNameError\u001b[0m: name 'untar_data' is not defined"
     ]
    }
   ],
   "source": [
    "from fastcore.all import *\n",
    "path = untar_data(URLs.PETS)\n",
    "dls = ImageDataLoaders.from_name_re(path, get_image_files(path/'images'), pat='(.+)_\\d+.jpg', item_tfms=Resize(460), batch_tfms=aug_transforms(size=224, min_scale=0.75))\n",
    "learn = vision_learner(dls, models.resnet50, metrics=accuracy)\n",
    "learn.fine_tune(1)\n",
    "learn.path = Path('.')\n",
    "learn.export()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.18"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}