<!DOCTYPE html> <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="shortcut icon" href="img/favicon.ico"> <title>Jupyter Notebooks - Neural Network Distiller</title> <link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/theme.css" type="text/css" /> <link rel="stylesheet" href="css/theme_extra.css" type="text/css" /> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css"> <link href="extra.css" rel="stylesheet"> <script> // Current page data var mkdocs_page_name = "Jupyter Notebooks"; var mkdocs_page_input_path = "jupyter.md"; var mkdocs_page_url = null; </script> <script src="js/jquery-2.1.1.min.js" defer></script> <script src="js/modernizr-2.8.3.min.js" defer></script> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script> <script>hljs.initHighlightingOnLoad();</script> </head> <body class="wy-body-for-nav" role="document"> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav"> <div class="wy-side-nav-search"> <a href="index.html" class="icon icon-home"> Neural Network Distiller</a> <div role="search"> <form id ="rtd-search-form" class="wy-form" action="./search.html" method="get"> <input type="text" name="q" placeholder="Search docs" title="Type search term here" /> </form> </div> </div> <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> <ul class="current"> <li class="toctree-l1"> <a class="" href="index.html">Home</a> </li> <li class="toctree-l1"> <a class="" href="install.html">Installation</a> </li> <li class="toctree-l1"> <a class="" href="usage.html">Usage</a> </li> <li class="toctree-l1"> <a class="" href="schedule.html">Compression Scheduling</a> </li> <li class="toctree-l1"> <span class="caption-text">Compressing Models</span> <ul class="subnav"> <li class=""> <a class="" href="pruning.html">Pruning</a> </li> <li class=""> <a class="" href="regularization.html">Regularization</a> </li> <li class=""> <a class="" href="quantization.html">Quantization</a> </li> <li class=""> <a class="" href="knowledge_distillation.html">Knowledge Distillation</a> </li> <li class=""> <a class="" href="conditional_computation.html">Conditional Computation</a> </li> </ul> </li> <li class="toctree-l1"> <span class="caption-text">Algorithms</span> <ul class="subnav"> <li class=""> <a class="" href="algo_pruning.html">Pruning</a> </li> <li class=""> <a class="" href="algo_quantization.html">Quantization</a> </li> <li class=""> <a class="" href="algo_earlyexit.html">Early Exit</a> </li> </ul> </li> <li class="toctree-l1"> <a class="" href="model_zoo.html">Model Zoo</a> </li> <li class="toctree-l1 current"> <a class="current" href="jupyter.html">Jupyter Notebooks</a> <ul class="subnav"> <li class="toctree-l2"><a href="#jupyter-environment">Jupyter environment</a></li> <ul> <li><a class="toctree-l3" href="#installation">Installation</a></li> <li><a class="toctree-l3" href="#launching-the-jupyter-server">Launching the Jupyter server</a></li> <li><a class="toctree-l3" href="#using-the-distiller-notebooks">Using the Distiller notebooks</a></li> </ul> </ul> </li> <li class="toctree-l1"> <a class="" href="design.html">Design</a> </li> <li class="toctree-l1"> <span class="caption-text">Tutorials</span> <ul class="subnav"> <li class=""> <a class="" href="tutorial-struct_pruning.html">Pruning Filters and Channels</a> </li> <li class=""> <a class="" href="tutorial-lang_model.html">Pruning a Language Model</a> </li> </ul> </li> </ul> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="index.html">Neural Network Distiller</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="breadcrumbs navigation"> <ul class="wy-breadcrumbs"> <li><a href="index.html">Docs</a> »</li> <li>Jupyter Notebooks</li> <li class="wy-breadcrumbs-aside"> </li> </ul> <hr/> </div> <div role="main"> <div class="section"> <h1 id="jupyter-environment">Jupyter environment</h1> <p>The Jupyter notebooks environment allows us to plan our compression session and load Distiller data summaries to study and analyze compression results.</p> <p>Each notebook has embedded instructions and explanations, so here we provide only a brief description of each notebook.</p> <h2 id="installation">Installation</h2> <p>Jupyter and its dependencies are included as part of the main <code>requirements.txt</code> file, so there is no need for a dedicated installation step.<br> However, to use the ipywidgets extension, you will need to enable it:</p> <pre><code>$ jupyter nbextension enable --py widgetsnbextension --sys-prefix </code></pre> <p>You may want to refer to the <a href="http://ipywidgets.readthedocs.io/en/latest/user_install.html">ipywidgets extension installation documentation</a>.</p> <p>Another extension which requires special installation handling is <a href="https://github.com/quantopian/qgrid">Qgrid</a>. Qgrid is a Jupyter notebook widget that adds interactive features, such as sorting, to Panadas DataFrames rendering. To enable Qgrid:</p> <pre><code>$ jupyter nbextension enable --py --sys-prefix qgrid </code></pre> <h2 id="launching-the-jupyter-server">Launching the Jupyter server</h2> <p>There are all kinds of options to use when launching Jupyter which you can use. The example below tells the server to listen to connections from any IP address, and not to launch the browser window, but of course, you are free to launch Jupyter any way you want.<br> Consult the <a href="http://jupyter.readthedocs.io/en/latest/running.html">user's guide</a> for more details.</p> <pre><code>$ jupyter-notebook --ip=0.0.0.0 --no-browser </code></pre> <h2 id="using-the-distiller-notebooks">Using the Distiller notebooks</h2> <p>The Distiller Jupyter notebooks are located in the <code>distiller/jupyter</code> directory.<br> They are provided as tools that you can use to prepare your compression experiments and study their results. We welcome new ideas and implementations of Jupyter.</p> <p>Roughly, the notebooks can be divided into three categories.</p> <h3 id="theory">Theory</h3> <ul> <li><a href="https://github.com/NervanaSystems/distiller/blob/master/jupyter/L1-regularization.ipynb">jupyter/L1-regularization.ipynb</a>: Experience hands-on how L1 and L2 regularization affect the solution of a toy loss-minimization problem, to get a better grasp on the interaction between regularization and sparsity.</li> <li><a href="https://github.com/NervanaSystems/distiller/blob/master/jupyter/alexnet_insights.ipynb">jupyter/alexnet_insights.ipynb</a>: This notebook reviews and compares a couple of pruning sessions on Alexnet. We compare distributions, performance, statistics and show some visualizations of the weights tensors.</li> </ul> <h3 id="preparation-for-compression">Preparation for compression</h3> <ul> <li><a href="https://github.com/NervanaSystems/distiller/blob/master/jupyter/model_summary.ipynb">jupyter/model_summary.ipynb</a>: Begin by getting familiar with your model. Examine the sizes and properties of layers and connections. Study which layers are compute-bound, and which are bandwidth-bound, and decide how to prune or regularize the model.</li> <li><a href="https://github.com/NervanaSystems/distiller/blob/master/jupyter/sensitivity_analysis.ipynb">jupyter/sensitivity_analysis.ipynb</a>: If you performed pruning sensitivity analysis on your model, this notebook can help you load the results and graphically study how the layers behave.</li> <li><a href="https://github.com/NervanaSystems/distiller/blob/master/jupyter/interactive_lr_scheduler.ipynb">jupyter/interactive_lr_scheduler.ipynb</a>: The learning rate decay policy affects pruning results, perhaps as much as it affects training results. Graph a few LR-decay policies to see how they behave.</li> <li><a href="https://github.com/NervanaSystems/distiller/blob/master/jupyter/agp_schedule.ipynb">jupyter/jupyter/agp_schedule.ipynb</a>: If you are using the Automated Gradual Pruner, this notebook can help you tune the schedule.</li> </ul> <h3 id="reviewing-experiment-results">Reviewing experiment results</h3> <ul> <li><a href="https://github.com/NervanaSystems/distiller/blob/master/jupyter/compare_executions.ipynb">jupyter/compare_executions.ipynb</a>: This is a simple notebook to help you graphically compare the results of executions of several experiments.</li> <li><a href="https://github.com/NervanaSystems/distiller/blob/master/jupyter/compression_insights.ipynb">jupyter/compression_insights.ipynb</a>: This notebook is packed with code, tables and graphs to us understand the results of a compression session. Distiller provides <em>summaries</em>, which are Pandas dataframes, which contain statistical information about you model. We chose to use Pandas dataframes because they can be sliced, queried, summarized and graphed with a few lines of code.</li> </ul> </div> </div> <footer> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <a href="design.html" class="btn btn-neutral float-right" title="Design">Next <span class="icon icon-circle-arrow-right"></span></a> <a href="model_zoo.html" class="btn btn-neutral" title="Model Zoo"><span class="icon icon-circle-arrow-left"></span> Previous</a> </div> <hr/> <div role="contentinfo"> <!-- Copyright etc --> </div> Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. </footer> </div> </div> </section> </div> <div class="rst-versions" role="note" style="cursor: pointer"> <span class="rst-current-version" data-toggle="rst-current-version"> <span><a href="model_zoo.html" style="color: #fcfcfc;">« Previous</a></span> <span style="margin-left: 15px"><a href="design.html" style="color: #fcfcfc">Next »</a></span> </span> </div> <script>var base_url = '.';</script> <script src="js/theme.js" defer></script> <script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" defer></script> <script src="search/main.js" defer></script> </body> </html>