Newer
Older
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
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"German Traffic Sign Recognition Benchmark (GTSRB)\n",
"=================================================\n",
"---\n",
"Introduction au Deep Learning (IDLE) - S. Arias, E. Maldonado, JL. Parouty - CNRS/SARI/DEVLOG - 2020 \n",
"\n",
"## Episode 5.1 : Full Convolutions / run\n",
"\n",
"Our main steps:\n",
" - Run Full-convolution.ipynb as a batch :\n",
" - Notebook mode\n",
" - Script mode \n",
" - Tensorboard follow up\n",
" \n",
"## 1/ Run a notebook as a batch\n",
"To run a notebook : \n",
"```jupyter nbconvert --to notebook --execute <notebook>```"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Done.\n"
]
}
],
"source": [
"%%bash\n",
"\n",
"# ---- This will execute and save a notebook\n",
"#\n",
"jupyter nbconvert --to notebook --execute '05-Full-convolutions.ipynb'\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2/ Export as a script\n",
"To export a notebook as a script : \n",
"```jupyter nbconvert --to script <notebook>```"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[NbConvertApp] Converting notebook 05-Full-convolutions.ipynb to script\n",
"[NbConvertApp] Writing 8775 bytes to 05-Full-convolutions.py\n"
]
}
],
"source": [
"%%bash\n",
"\n",
"# ---- This will convert notebook to a notebook.py script\n",
"#\n",
"jupyter nbconvert --to script '05-Full-convolutions.ipynb'\n"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"total 8156\n",
"-rw-r--r-- 1 pjluc pjluc 16893 Jan 19 15:07 01-Preparation-of-data.ipynb\n",
"-rw-r--r-- 1 pjluc pjluc 9181 Jan 19 15:08 02-First-convolutions.ipynb\n",
"-rw-r--r-- 1 pjluc pjluc 12879 Jan 19 15:09 03-Tracking-and-visualizing.ipynb\n",
"-rw-r--r-- 1 pjluc pjluc 10667 Jan 19 15:10 04-Data-augmentation.ipynb\n",
"-rw-r--r-- 1 pjluc pjluc 3325 Jan 19 15:50 05.1-Full-convolutions-run.ipynb\n",
"-rw-r--r-- 1 pjluc pjluc 19865 Jan 19 15:17 05.2-Full-convolutions-reports.ipynb\n",
"-rw-r--r-- 1 pjluc pjluc 14466 Jan 19 15:11 05-Full-convolutions.ipynb\n",
"-rw-r--r-- 1 pjluc pjluc 14533 Jan 19 15:35 05-Full-convolutions.nbconvert.ipynb\n",
"-rw-r--r-- 1 pjluc pjluc 8775 Jan 19 15:43 05-Full-convolutions.py\n",
"-rw-r--r-- 1 pjluc pjluc 12346 Jan 19 15:47 99 Scripts-Tensorboard.ipynb\n",
"drwxr-xr-x 1 pjluc pjluc 512 Jan 10 22:10 data\n",
"drwxr-xr-x 1 pjluc pjluc 512 Jan 19 15:07 fidle\n",
"-rw-r--r-- 1 pjluc pjluc 7391072 Jan 19 00:41 foo.h5\n",
"-rw-r--r-- 1 pjluc pjluc 2816 Jan 11 15:45 README.ipynb\n",
"drwxr-xr-x 1 pjluc pjluc 512 Jan 19 15:35 run\n"
]
}
],
"source": [
"!ls -l"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3/ Batch submission\n",
"Create batch script :"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Writing ./run/batch_full_convolutions.sh\n"
]
}
],
"source": [
"%%writefile \"./run/batch_full_convolutions.sh\"\n",
"\n",
"#!/bin/batch\n",
"\n",
"# ----------------------------------\n",
"# _ _ _\n",
"# | |__ __ _| |_ ___| |__\n",
"# | '_ \\ / _` | __/ __| '_ \\\n",
"# | |_) | (_| | || (__| | | |\n",
"# |_.__/ \\__,_|\\__\\___|_| |_|\n",
"# Full convolutions\n",
"# ----------------------------------\n",
"#\n",
"CONDA_ENV=\"deeplearning2\"\n",
"RUN_DIR=\"~/fidle/GTSRB\"\n",
"RUN_SCRIPT=\"05-Full-convolutions.py\"\n",
"\n",
"# ---- Cuda Conda initialization\n",
"#\n",
"echo -e 'Init environment with cuda and conda...\\n'\n",
"source /applis/environments/cuda_env.sh dahu 10.0\n",
"source /applis/environments/conda.sh\n",
"#\n",
"conda activate \"$CONDA_ENV\"\n",
"\n",
"# ---- Run it...\n",
"#\n",
"cd $RUN_DIR\n",
"$RUN_SCRIPT"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.7.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}