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
{
"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 --ExecutePreprocessor.timeout=-1 --to notebook --output='./run/full_convolutions' --execute '05-Full-convolutions.ipynb'\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2/ Export as a script (better choice)\n",
"```jupyter nbconvert --to script <notebook>``` \n",
"To run the script : \n",
"```ipython <script>```"
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[NbConvertApp] Converting notebook 05-Full-convolutions.ipynb to script\n",
"[NbConvertApp] Writing 8155 bytes to ./run/full_convolutions.py\n"
"# ---- This will convert a notebook to a notebook.py script\n",
"jupyter nbconvert --to script --output='./run/full_convolutions' '05-Full-convolutions.ipynb'"
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-rwxr-xr-x 1 paroutyj l-simap 8155 Jan 19 22:24 ./run/full_convolutions.py\n"
"!ls -l ./run/*.py"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3/ Batch submission\n",
"Create batch script :"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting ./run/batch_full_convolutions.sh\n"
]
}
],
"source": [
"%%writefile \"./run/batch_full_convolutions.sh\"\n",
"#!/bin/bash\n",
"#OAR -n Full convolutions\n",
"#OAR -t gpu\n",
"#OAR -l /nodes=1/gpudevice=1,walltime=01:00:00\n",
"#OAR --stdout full_convolutions.out\n",
"#OAR --stderr full_convolutions.err\n",
"#OAR --project deeplearningshs\n",
"#---- For cpu\n",
"# use :\n",
"# OAR -l /nodes=1/core=32,walltime=01:00:00\n",
"# and add a 2>/dev/null to ipython xxx\n",
"\n",
"# ----------------------------------\n",
"# _ _ _\n",
"# | |__ __ _| |_ ___| |__\n",
"# | '_ \\ / _` | __/ __| '_ \\\n",
"# | |_) | (_| | || (__| | | |\n",
"# |_.__/ \\__,_|\\__\\___|_| |_|\n",
"# Full convolutions\n",
"# ----------------------------------\n",
"#\n",
"\n",
"CONDA_ENV=deeplearning2\n",
"RUN_DIR=~/fidle/GTSRB\n",
"RUN_SCRIPT=./run/full_convolutions.py\n",
"\n",
"# ---- Cuda Conda initialization\n",
"#\n",
"echo '------------------------------------------------------------'\n",
"echo \"Start : $0\"\n",
"echo '------------------------------------------------------------'\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",
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
"ipython $RUN_SCRIPT"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-rwxr-xr-x 1 paroutyj l-simap 955 Jan 19 22:13 ./run/batch_full_convolutions.sh\n",
"-rwxr-xr-x 1 paroutyj l-simap 8155 Jan 19 22:24 ./run/full_convolutions.py\n"
]
}
],
"source": [
"%%bash\n",
"chmod 755 \"./run/batch_full_convolutions.sh\"\n",
"chmod 755 \"./run/full_convolutions.py\"\n",
"ls -l ./run/*full_convolutions*"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"%%bash\n",
"./run/batch_full_convolutions.sh"
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
]
},
{
"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
}