{ "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": "raw", "metadata": {}, "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", "To export a notebook as a script : \n", "```jupyter nbconvert --to script <notebook>``` \n", "To run the script : \n", "```ipython <script>```" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "[NbConvertApp] Converting notebook 05-Full-convolutions.ipynb to script\n", "[NbConvertApp] Writing 11305 bytes to ./run/full_convolutions_B.py\n" ] } ], "source": [ "%%bash\n", "\n", "# ---- This will convert a notebook to a notebook.py script\n", "#\n", "jupyter nbconvert --to script --output='./run/full_convolutions_B' '05-Full-convolutions.ipynb'" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-rw-r--r-- 1 pjluc pjluc 11305 Jan 21 00:13 ./run/full_convolutions_B.py\n" ] } ], "source": [ "!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": [ "Writing ./run/batch_full_convolutions_B.sh\n" ] } ], "source": [ "%%writefile \"./run/batch_full_convolutions_B.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 _batch/full_convolutions_%jobid%.out\n", "#OAR --stderr _batch/full_convolutions_%jobid%.err\n", "#OAR --project deeplearningshs\n", "\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_B.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", "ipython $RUN_SCRIPT" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-rwxr-xr-x 1 pjluc pjluc 1045 Jan 21 00:15 ./run/batch_full_convolutions_B.sh\n", "-rwxr-xr-x 1 pjluc pjluc 611 Jan 19 15:53 ./run/batch_full_convolutions.sh\n", "-rwxr-xr-x 1 pjluc pjluc 11305 Jan 21 00:13 ./run/full_convolutions_B.py\n" ] } ], "source": [ "%%bash\n", "chmod 755 ./run/*.sh\n", "chmod 755 ./run/*.py\n", "ls -l ./run/*full_convolutions*" ] }, { "cell_type": "raw", "metadata": {}, "source": [ "%%bash\n", "./run/batch_full_convolutions.sh" ] }, { "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 }