Skip to content
Snippets Groups Projects
  1. Jul 15, 2018
  2. Jul 11, 2018
    • Neta Zmora's avatar
      More robust handling of data-parallel/serial graphs (#27) · b64be690
      Neta Zmora authored
      Remove the complicated logic trying to handle data-parallel models as
      serially-processed models, and vice versa.
      
      *Function distiller.utils.make_non_parallel_copy() does the heavy lifting of
      replacing  all instances of nn.DataParallel in a model with instances of
      DoNothingModuleWrapper.
      The DoNothingModuleWrapper wrapper does nothing but forward to the
      wrapped module.  This is a trick we use to transform a data-parallel model
      to a serial-processed model.
      
      *SummaryGraph uses a copy of the model after the model is processed by
      distiller.make_non_parallel_copy() which renders the model non-data-parallel.
      
      *The same goes for model_performance_summary()
      
      *Model inputs are explicitly placed on the Cuda device, since now all models are
      Executed on the CPU.  Previously, if a model was not created using
      nn.DataParallel, then the model was not explicitly placed on the Cuda device.
      
      *The logic in distiller.CompressionScheduler that attempted to load a
      model parallel model and process it serially, or load a serial model and
      process it data-parallel, was removed.  This removes a lot of fuzziness and makes
      the code more robust: we do not needlessly try to be heroes.
      
      * model summaries - remove pytorch 0.4 warning
      
      * create_model: remove redundant .cuda() call
      
      * Tests: support both parallel and serial tests
      Unverified
      b64be690
  3. Jul 08, 2018
    • Neta Zmora's avatar
      Bug fix in connectivity_summary; extend the API of create_png() · af4bf3dc
      Neta Zmora authored
      *connectivity_summary() does not use SummaryGraph correctly:
       Recently we changed the internal representation of SummaryGraph.ops, but
       connectivity_summary() and connectivity_summary_verbose() were not updated.
       Fixed that.
      
      *Extend the API of create_png():
       Add to the signature of create_png() and create_pydot_graph() rankdir and
       External styles.  These are explained in the docstrings.
      
      *Added documentation to the PNG drawing functions
      
      *Added tests to catch trivial connectivity_summary() bugs
      af4bf3dc
  4. Jun 19, 2018
    • Guy Jacob's avatar
      Make PNG summary compatible with latest SummaryGraph class changes (#7) · 9e57219e
      Guy Jacob authored
      * Modify 'create_png' to use the correct data structures (dicts instead
        lists, etc.)
      * Handle case where an op was called not from a module. This relates to:
        * ONNX->"User-Friendly" name conversion to account for cases where
        * Detection of existing op with same name
        In both cases use the ONNX op type in addition to the op name
      * Return an "empty" shape instead of None when ONNX couldn't infer
        a parameter's shape
      * Expose option of PNG summary with parameters to user
      Unverified
      9e57219e
  5. Jun 10, 2018
    • Neta Zmora's avatar
      Thinning (#6) · 42650340
      Neta Zmora authored
      * Large update containing new thinning algorithm.
      
      Thinning a model is the process of taking a dense network architecture with a parameter model that
      has structure-sparsity (filters or channels) in the weights tensors of convolution layers, and making changes in the network architecture and parameters, in order to completely remove the structures.
      The new architecture is smaller (condensed), with less channels and filters in some of the convolution layers.  Linear and BatchNormalization layers are also adjusted as required.
      
      To perform thinning, we create a SummaryGraph (‘sgraph’) of our model.  We use the ‘sgraph’ to infer the
      data-dependency between the modules in the PyTorch network.  This entire process is not trivial and will be
      documented in a different place.
      
      Large refactoring of SummaryGraph to support the new thinning requirement for traversing successors and predecessors.
      - Operations (ops) are now stored in a dictionary, so that they can be accessed quickly by name.
      - Refactor Operation construction code
      - Added support for search a node’s predecessors and successors.  You can search for all predecessors/successors by depth, or by type.
      - create_png now supports an option to display the parameter nodes
      
      Updated schedules with new thinning syntax.
      
      * Thinning: support iterative thinning of models
      
      THere's a caveat with this commit: when using this code you will
      need to train with SGD momentum=0.
      The momentum update is dependent on the weights, and because we
      dynamically change the weights shapes, we need to either make the
      apporpriate changes in the Optimizer, or disable the momentum.
      For now, we disable the momentum
      
      * Thinning: move the application of FilterRemover to on_minibatch_begin
      
      * Thinning: fix syntax error
      
      * Word-level language model compression
      
      Added an implementation of Baidu’s RNN pruning scheme:
      Narang, Sharan & Diamos, Gregory & Sengupta, Shubho & Elsen, Erich. (2017).
          Exploring Sparsity in Recurrent Neural Networks.
          (https://arxiv.org/abs/1704.05119)
      
      Added an example of word-level language model compression.
      The language model is based on PyTorch’s example:
      https://github.com/pytorch/examples/tree/master/word_language_model
      
      Added an AGP pruning schedule and RNN pruning schedule to demonstrate
      compression of the language model.
      
      * thinning: remove dead code
      
      * remove resnet18 filter pruning since the scheduler script is incomplete
      
      * thinning: fix indentation error
      
      * thinning: remove dead code
      
      * thinning: updated resnet20-CIFAR filter-removsal reference checkpoints
      
      * thinning: updated resnet20-CIFAR filter-removal reference schedules
      
      These are for use with the new thinning scheudle algorithm
      Unverified
      42650340
  6. May 16, 2018
    • Neta Zmora's avatar
      PyTorch 0.4 improvement to SummaryGraph · 32c01c28
      Neta Zmora authored
      PyTorch 0.4 now fully supports the ONNX export features that are needed
      in order to create a SummaryGraph, which is sort of a "shadow graph" for
      PyTorch models.
      
      The big advantage of SummaryGraph is that it gives us information about
      the connectivity of nodes.  With connectivity information we can compute
      per-node MAC (compute) and BW, and better yet, we can remove channels,
      filters, and layers (more on this in future commits).
      
      In this commit we (1) replace the long and overly-verbose ONNX node names,
      with PyTorch names; and (2) move MAC and BW attributes from the Jupyter
      notebook to the SummaryGraph.
      32c01c28
    • Neta Zmora's avatar
      384f4740
  7. Apr 25, 2018
  8. Apr 24, 2018
Loading