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