Skip to content

Commit bfef24b

Browse files
Update 05-checkpoint.ipynb
1 parent e8e346d commit bfef24b

File tree

1 file changed

+127
-8
lines changed

1 file changed

+127
-8
lines changed

.ipynb_checkpoints/05-checkpoint.ipynb

Lines changed: 127 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
"cell_type": "code",
1919
"execution_count": 1,
2020
"id": "1129b80d-f36f-46b9-9355-e9e2968c681f",
21-
"metadata": {},
21+
"metadata": {
22+
"tags": []
23+
},
2224
"outputs": [
2325
{
2426
"data": {
2527
"text/plain": [
26-
"('1.9.1', '0.10.1')"
28+
"('2.1.0.dev20230713', '0.16.0.dev20230713')"
2729
]
2830
},
2931
"execution_count": 1,
@@ -38,19 +40,136 @@
3840
]
3941
},
4042
{
41-
"cell_type": "code",
42-
"execution_count": null,
43-
"id": "c029fad0-6880-49d5-b677-8d7ddbd79504",
43+
"cell_type": "markdown",
44+
"id": "80b49efd-6111-4b27-92d9-4ba282874484",
4445
"metadata": {},
46+
"source": [
47+
"Now we've got the versions of torch and torchvision, we're after, let's import the code we've writte in previous section "
48+
]
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": 5,
53+
"id": "c1d9b7cd-1612-41db-8745-0ddd226442d3",
54+
"metadata": {
55+
"tags": []
56+
},
57+
"outputs": [],
58+
"source": [
59+
"# Continue with regular imports\n",
60+
"import matplotlib.pyplot as plt\n",
61+
"import torch\n",
62+
"import torchvision\n",
63+
"\n",
64+
"from torch import nn\n",
65+
"from torchvision import transforms\n",
66+
"\n",
67+
"# Try to get torchinfo, install it if it doesn't work\n",
68+
"try:\n",
69+
" from torchinfo import summary\n",
70+
"except:\n",
71+
" print(\"[INFO] Couldn't find torchinfo... installing it.\")\n",
72+
" !pip install -q torchinfo\n",
73+
" from torchinfo import summary\n",
74+
"\n",
75+
"# Try to import the going_modular directory, download it from GitHub if it doesn't work\n",
76+
"try:\n",
77+
" from going_modular.going_modular import data_setup, engine\n",
78+
"except:\n",
79+
" # Get the going_modular scripts\n",
80+
" print(\"[INFO] Couldn't find going_modular scripts... downloading them from GitHub.\")\n",
81+
" !git clone https://github.com/mrdbourke/pytorch-deep-learning\n",
82+
" !mv pytorch-deep-learning/going_modular .\n",
83+
" !mv pytorch-deep-learning/data/pizza_steak_sushi_20_percent.zip ./data/05\n",
84+
" !unzip ./data/05/pizza_steak_sushi_20_percent.zip\n",
85+
" # !rm -rf pytorch-deep-learning\n",
86+
" from going_modular.going_modular import data_setup, engine"
87+
]
88+
},
89+
{
90+
"cell_type": "code",
91+
"execution_count": 6,
92+
"id": "d91a1f33-88a5-41b1-81e2-ad03cde5b3a1",
93+
"metadata": {
94+
"tags": []
95+
},
96+
"outputs": [],
97+
"source": [
98+
"device = 'cuda' if torch.cuda.is_available() else 'cpu'"
99+
]
100+
},
101+
{
102+
"cell_type": "code",
103+
"execution_count": 7,
104+
"id": "e844a820-6e66-4589-9424-06c8c57bec42",
105+
"metadata": {
106+
"tags": []
107+
},
108+
"outputs": [
109+
{
110+
"name": "stdout",
111+
"output_type": "stream",
112+
"text": [
113+
"Fri Jul 14 15:57:29 2023 \n",
114+
"+-----------------------------------------------------------------------------+\n",
115+
"| NVIDIA-SMI 525.125.06 Driver Version: 525.125.06 CUDA Version: 12.0 |\n",
116+
"|-------------------------------+----------------------+----------------------+\n",
117+
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
118+
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n",
119+
"| | | MIG M. |\n",
120+
"|===============================+======================+======================|\n",
121+
"| 0 NVIDIA GeForce ... Off | 00000000:26:00.0 On | N/A |\n",
122+
"| 0% 47C P8 11W / 170W | 561MiB / 12288MiB | 20% Default |\n",
123+
"| | | N/A |\n",
124+
"+-------------------------------+----------------------+----------------------+\n",
125+
" \n",
126+
"+-----------------------------------------------------------------------------+\n",
127+
"| Processes: |\n",
128+
"| GPU GI CI PID Type Process name GPU Memory |\n",
129+
"| ID ID Usage |\n",
130+
"|=============================================================================|\n",
131+
"| 0 N/A N/A 962 G /usr/lib/xorg/Xorg 302MiB |\n",
132+
"| 0 N/A N/A 1240 G /usr/bin/gnome-shell 46MiB |\n",
133+
"| 0 N/A N/A 1613 G ...158999189576873813,262144 167MiB |\n",
134+
"| 0 N/A N/A 22205 G ...AAAAAAAAA= --shared-files 9MiB |\n",
135+
"| 0 N/A N/A 25300 G ...RendererForSitePerProcess 19MiB |\n",
136+
"| 0 N/A N/A 33805 G ...features=BackForwardCache 8MiB |\n",
137+
"+-----------------------------------------------------------------------------+\n"
138+
]
139+
}
140+
],
141+
"source": [
142+
"!nvidia-smi"
143+
]
144+
},
145+
{
146+
"cell_type": "markdown",
147+
"id": "7d096286-9403-4eba-93f8-8be7520ef5d0",
148+
"metadata": {
149+
"tags": []
150+
},
151+
"source": [
152+
"## Get data\n",
153+
"\n",
154+
"We need our pizza, steak, sushi data to build a transfer learning model"
155+
]
156+
},
157+
{
158+
"cell_type": "code",
159+
"execution_count": 10,
160+
"id": "dd6e69cc-da20-4ecf-9c69-bd3ddeff770c",
161+
"metadata": {
162+
"tags": []
163+
},
45164
"outputs": [],
46165
"source": [
47-
"!conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch-nightly -c nvidia"
166+
"# !unzip ./data/05/pizza_steak_sushi_20_percent.zip"
48167
]
49168
},
50169
{
51170
"cell_type": "code",
52171
"execution_count": null,
53-
"id": "11d88c75-4a1f-42be-aef9-119fb66c32b0",
172+
"id": "a5cc7e00-627a-42ea-9d74-f59ddf3760b9",
54173
"metadata": {},
55174
"outputs": [],
56175
"source": []
@@ -72,7 +191,7 @@
72191
"name": "python",
73192
"nbconvert_exporter": "python",
74193
"pygments_lexer": "ipython3",
75-
"version": "3.8.8"
194+
"version": "3.11.3"
76195
}
77196
},
78197
"nbformat": 4,

0 commit comments

Comments
 (0)