-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GPU training support via CuPy, Jupyter notebooks, ROC plots and 4…
… more * Change NumPy to CuPy so that GPU training is only possible * Add notebooks for local Jupyter and Google Colab (there are differencies i.e. in plotting). Google Colab training with GPU is possible (and recommended!) * Add plotting ROC curves for every class and misclassified examples after training process * Update requirements * Update command line parameters * Update logger setup * Add plots generated after best models training
- Loading branch information
1 parent
316d86f
commit 9d46d45
Showing
34 changed files
with
532 additions
and
75 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Thanks to this notebook you can run training of the model on `Google Colab` - it means that you can train model without downloading files to your local computer and without having GPU!\n", | ||
"\n", | ||
"After the training, plots with losses, accuracies, missclassified examples and ROC are plotted." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"colab": { | ||
"base_uri": "https://localhost:8080/", | ||
"height": 136 | ||
}, | ||
"colab_type": "code", | ||
"id": "uTVcwQTIsYa0", | ||
"outputId": "45e4a32d-82f9-4c19-bab3-59cf1c9f9c95" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"!git clone https://github.com/VictorAtPL/MNIST_FCDN_NumPy" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"colab": { | ||
"base_uri": "https://localhost:8080/", | ||
"height": 34 | ||
}, | ||
"colab_type": "code", | ||
"id": "7fYVH7b5sgTJ", | ||
"outputId": "7d8e79af-f9d2-4d30-ec87-5afabeac18c8" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"%cd MNIST_FCDN_NumPy" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"colab": { | ||
"base_uri": "https://localhost:8080/", | ||
"height": 85 | ||
}, | ||
"colab_type": "code", | ||
"id": "g-LevFszsiIf", | ||
"outputId": "ca044407-1df4-40a3-ee09-6d664be4afb2" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"!sed -i 's/80/100/g' requirements.txt\n", | ||
"!pip install -r requirements.txt" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"colab": { | ||
"base_uri": "https://localhost:8080/", | ||
"height": 799 | ||
}, | ||
"colab_type": "code", | ||
"id": "d-s47af_tA_l", | ||
"outputId": "106bd3fa-b9c9-4f87-c788-864dee4ef0f5" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"%cd data/\n", | ||
"!wget http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz\n", | ||
"!wget http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz\n", | ||
"!wget http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz\n", | ||
"!wget http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz\n", | ||
"!gunzip -f *\n", | ||
"%cd .." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"colab": {}, | ||
"colab_type": "code", | ||
"id": "mwlbdk80wvph" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"!export PYTHONPATH=`pwd`" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"colab": { | ||
"base_uri": "https://localhost:8080/", | ||
"height": 316 | ||
}, | ||
"colab_type": "code", | ||
"id": "tsSDqx4XskDp", | ||
"outputId": "7bfb2d6c-d81f-4324-c686-7590d5743b8f", | ||
"scrolled": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import logging\n", | ||
"\n", | ||
"%matplotlib inline\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"\n", | ||
"from utils import setup_logger\n", | ||
"from run import train\n", | ||
"\n", | ||
"plt.style.use('seaborn-pastel')\n", | ||
"\n", | ||
"setup_logger()\n", | ||
"\n", | ||
"# Run following line if you don't want information from logger being printed\n", | ||
"#setup_logger(logging.NOTSET)\n", | ||
"\n", | ||
"# Run following line if you want the training process to be most verbose\n", | ||
"#setup_logger(logging.DEBUG)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"args = {\n", | ||
" \"data_dir\": \"data/\",\n", | ||
" \"batch_size\": 1024,\n", | ||
" \"neurons_in_hidden_blocks\": [512, 512],\n", | ||
" \"weight_decay_lambda\": 0.2,\n", | ||
" \"learning_rate\": 0.001,\n", | ||
" \"epochs\": 15,\n", | ||
" \"dropout_keep_prob\": 0.6,\n", | ||
" \"train_with_validation\": True,\n", | ||
" \"plot_graphs\": True\n", | ||
"}\n", | ||
"\n", | ||
"train(args)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"accelerator": "GPU", | ||
"colab": { | ||
"name": "Google_Colab.ipynb", | ||
"provenance": [], | ||
"version": "0.3.2" | ||
}, | ||
"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.6.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Thanks to this notebook you can run training of the model quite interactively - it means that you can see plots updated live with every step of training.\n", | ||
"\n", | ||
"After the training, plot with missclassified examples and ROC are also plotted." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"scrolled": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"%load_ext autoreload\n", | ||
"%autoreload 2" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"colab": { | ||
"base_uri": "https://localhost:8080/", | ||
"height": 316 | ||
}, | ||
"colab_type": "code", | ||
"id": "tsSDqx4XskDp", | ||
"outputId": "7bfb2d6c-d81f-4324-c686-7590d5743b8f", | ||
"scrolled": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import logging\n", | ||
"\n", | ||
"%matplotlib notebook\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"\n", | ||
"from utils import setup_logger\n", | ||
"from run import train\n", | ||
"\n", | ||
"plt.style.use('seaborn-pastel')\n", | ||
"\n", | ||
"setup_logger()\n", | ||
"\n", | ||
"# Run following line if you don't want information from logger being printed\n", | ||
"#setup_logger(logging.NOTSET)\n", | ||
"\n", | ||
"# Run following line if you want the training process to be most verbose\n", | ||
"#setup_logger(logging.DEBUG)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"scrolled": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"args = {\n", | ||
" \"data_dir\": \"data/\",\n", | ||
" \"batch_size\": 1024,\n", | ||
" \"neurons_in_hidden_blocks\": [512, 512],\n", | ||
" \"weight_decay_lambda\": 0.2,\n", | ||
" \"learning_rate\": 0.001,\n", | ||
" \"epochs\": 15,\n", | ||
" \"dropout_keep_prob\": 0.6,\n", | ||
" \"train_with_validation\": True,\n", | ||
" \"plot_graphs\": True\n", | ||
"}\n", | ||
"\n", | ||
"train(args)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"accelerator": "GPU", | ||
"colab": { | ||
"name": "Google_Colab.ipynb", | ||
"provenance": [], | ||
"version": "0.3.2" | ||
}, | ||
"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.6.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 1 | ||
} |
Oops, something went wrong.