-
-
Save AvantiShri/e77ace62219846746537f88ce50388d2 to your computer and use it in GitHub Desktop.
EoinKennyModelLoadTest.ipynb
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
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "EoinKennyModelLoadTest.ipynb", | |
"version": "0.3.2", | |
"provenance": [], | |
"collapsed_sections": [], | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/AvantiShri/e77ace62219846746537f88ce50388d2/eoinkennymodelloadtest.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"metadata": { | |
"id": "naSX9st37JMS", | |
"colab_type": "code", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 173 | |
}, | |
"outputId": "91a3d4b0-cc81-408f-bddd-0afe86b8d0a4" | |
}, | |
"cell_type": "code", | |
"source": [ | |
"!pip install deeplift" | |
], | |
"execution_count": 1, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"Collecting deeplift\n", | |
" Downloading https://files.pythonhosted.org/packages/54/23/938b1c8cdfaf2babc5b87f1c37099644d312e10e98a283f33dd88c4ce557/deeplift-0.6.8.1.tar.gz\n", | |
"Requirement already satisfied: numpy>=1.9 in /usr/local/lib/python3.6/dist-packages (from deeplift) (1.14.6)\n", | |
"Building wheels for collected packages: deeplift\n", | |
" Running setup.py bdist_wheel for deeplift ... \u001b[?25l-\b \bdone\n", | |
"\u001b[?25h Stored in directory: /root/.cache/pip/wheels/c0/32/2d/141e8cc6b98bc392a6a41025672b57e623c4a49cdb96c8ca47\n", | |
"Successfully built deeplift\n", | |
"Installing collected packages: deeplift\n", | |
"Successfully installed deeplift-0.6.8.1\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"id": "HFA8AqfD7RI6", | |
"colab_type": "code", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 314 | |
}, | |
"outputId": "2facae7d-4186-4114-973d-ea71e4052a6c" | |
}, | |
"cell_type": "code", | |
"source": [ | |
"!wget https://github.com/kundajelab/deeplift/files/2750526/NN.h5.zip" | |
], | |
"execution_count": 3, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"--2019-01-11 17:19:44-- https://github.com/kundajelab/deeplift/files/2750526/NN.h5.zip\n", | |
"Resolving github.com (github.com)... 192.30.255.112, 192.30.255.113\n", | |
"Connecting to github.com (github.com)|192.30.255.112|:443... connected.\n", | |
"HTTP request sent, awaiting response... 302 Found\n", | |
"Location: https://github-production-repository-file-5c1aeb.s3.amazonaws.com/60138482/2750526?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190111%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190111T171944Z&X-Amz-Expires=300&X-Amz-Signature=c84b8f7ef134f72ce3379e8578153282c1d7d359c9aac3d07c1e306b0bfd5bec&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3Bfilename%3DNN.h5.zip&response-content-type=application%2Fzip [following]\n", | |
"--2019-01-11 17:19:44-- https://github-production-repository-file-5c1aeb.s3.amazonaws.com/60138482/2750526?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190111%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190111T171944Z&X-Amz-Expires=300&X-Amz-Signature=c84b8f7ef134f72ce3379e8578153282c1d7d359c9aac3d07c1e306b0bfd5bec&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3Bfilename%3DNN.h5.zip&response-content-type=application%2Fzip\n", | |
"Resolving github-production-repository-file-5c1aeb.s3.amazonaws.com (github-production-repository-file-5c1aeb.s3.amazonaws.com)... 52.216.169.67\n", | |
"Connecting to github-production-repository-file-5c1aeb.s3.amazonaws.com (github-production-repository-file-5c1aeb.s3.amazonaws.com)|52.216.169.67|:443... connected.\n", | |
"HTTP request sent, awaiting response... 200 OK\n", | |
"Length: 3893268 (3.7M) [application/zip]\n", | |
"Saving to: ‘NN.h5.zip’\n", | |
"\n", | |
"NN.h5.zip 100%[===================>] 3.71M 7.21MB/s in 0.5s \n", | |
"\n", | |
"2019-01-11 17:19:45 (7.21 MB/s) - ‘NN.h5.zip’ saved [3893268/3893268]\n", | |
"\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"id": "tD7gKJU17TnT", | |
"colab_type": "code", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 52 | |
}, | |
"outputId": "6ec7858c-5cad-450a-dbb5-50d9ce1798ab" | |
}, | |
"cell_type": "code", | |
"source": [ | |
"!unzip NN.h5.zip" | |
], | |
"execution_count": 4, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"Archive: NN.h5.zip\n", | |
" inflating: NN.h5 \n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"id": "3IgaFZiJ7Ww6", | |
"colab_type": "code", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 312 | |
}, | |
"outputId": "75d5219b-2b58-47ef-85ac-36f12310e9a2" | |
}, | |
"cell_type": "code", | |
"source": [ | |
"from deeplift.conversion import kerasapi_conversion as kc\n", | |
"kc.convert_model_from_saved_files(\"NN.h5\")" | |
], | |
"execution_count": 5, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"nonlinear_mxts_mode is set to: DeepLIFT_GenomicsDefault\n", | |
"For layer 1 the preceding linear layer is 0 of type Conv2D;\n", | |
"In accordance with nonlinear_mxts_mode=DeepLIFT_GenomicsDefault we are setting the NonlinearMxtsMode to Rescale\n", | |
"Heads-up: current implementation assumes maxpool layer is followed by a linear transformation (conv/dense layer)\n", | |
"For layer 5 the preceding linear layer is 4 of type Conv2D;\n", | |
"In accordance with nonlinear_mxts_mode=DeepLIFT_GenomicsDefault we are setting the NonlinearMxtsMode to Rescale\n", | |
"Heads-up: current implementation assumes maxpool layer is followed by a linear transformation (conv/dense layer)\n", | |
"For layer 9 the preceding linear layer is 8 of type Conv2D;\n", | |
"In accordance with nonlinear_mxts_mode=DeepLIFT_GenomicsDefault we are setting the NonlinearMxtsMode to Rescale\n", | |
"For layer 13 the preceding linear layer is 12 of type Dense;\n", | |
"In accordance with nonlinear_mxts_modeDeepLIFT_GenomicsDefault we are setting the NonlinearMxtsMode to RevealCancel\n", | |
"For layer 16 the preceding linear layer is 15 of type Dense;\n", | |
"In accordance with nonlinear_mxts_modeDeepLIFT_GenomicsDefault we are setting the NonlinearMxtsMode to RevealCancel\n", | |
"Heads-up: I assume softmax is the output layer, not an intermediate one; if it's an intermediate layer, please let me know and I will prioritise that use-case\n", | |
"For layer 19 the preceding linear layer is 18 of type Dense;\n", | |
"In accordance with nonlinear_mxts_modeDeepLIFT_GenomicsDefault we are setting the NonlinearMxtsMode to RevealCancel\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"<deeplift.models.SequentialModel at 0x7fad34026da0>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
}, | |
"execution_count": 5 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"id": "u7AN2tj27eQB", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"cell_type": "code", | |
"source": [ | |
"" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment