Skip to content
Snippets Groups Projects
  1. May 19, 2019
  2. May 16, 2019
  3. May 15, 2019
    • Neta Zmora's avatar
      SummaryGraph: fix ‘weights_vol’ attribute for conv and linear layers · 08b5cd95
      Neta Zmora authored
      The weights_vol attribute reflects the size (volume) of an SG node’s
      weights tensor.  The calculation of the weights volume was wrong.
      This does not have any significant impact because this attribute is
      not used.
      08b5cd95
    • Neta Zmora's avatar
    • Lev Zlotnik's avatar
      Added convert_model_to_distiller_lstm (#259) · 12d6b7e2
      Lev Zlotnik authored
      * Traverses recursively through entire model and replaces all submodules of type `nn.LSTM` and `nn.LSTMCell` with distiller versions
      Unverified
      12d6b7e2
    • Neta Zmora's avatar
    • Neta Zmora's avatar
      SummaryGraph: fix ‘weights_vol’ attribute for conv and linear layers · a3f2ce2d
      Neta Zmora authored
      The weights_vol attribute reflects the size (volume) of an SG node’s
      weights tensor.  The calculation of the weights volume was wrong.
      This does not have any significant impact because this attribute is
      not used.
      wq
      a3f2ce2d
    • Guy Jacob's avatar
      Activation Histograms (#254) · 9405679f
      Guy Jacob authored
      Added a collector for activation histograms (sub-class of
      ActivationStatsCollector). It is stats-based, meaning it requires
      pre-computed min/max stats per tensor. This is done in order to prevent
      the need to save all of the activation tensors throughout the run.
      The stats are expected in the format generated by
      QuantCalibrationStatsCollector.
      
      Details:
      
      * Implemented ActivationHistogramsCollector
      * Added Jupyter notebook showcasing activation histograms
      * Implemented helper function that performs the stats collection pass
        and histograms pass in one go
      * Also added separate helper function just for quantization stats
        collection
      * Integrated in image classification sample
      * data_loaders.py: Added option to have a fixed subset throughout
        within the same session. Using it to keep the same subset between
        the stats collection and histograms collection phases.
      * Other changes:
        * Calling assign_layer_fq_names in base-class of collectors. We do
          this since the collectors, as implemented so far, assume this is
          done. So makes sense to just do it in the base class instead of
          expecting the user to do it.
        * Enforcing a non-parallel model for quantization stats and
          histograms collectors
        * Jupyter notebooks - add utility function to enable loggers in
          notebooks. This allows us to see any logging done by Distiller
          APIs called from notebooks.
      Unverified
      9405679f
    • Guy Jacob's avatar
      SummaryGraph changes: _force_outplace + OrderedDicts · f1f0d753
      Guy Jacob authored
      * Set _force_outplace when calling get_trace_graph. This is a
        workaround for losing scope information for certain in-place
        operations
      * Switch all dicts to OrderedDicts
      f1f0d753
  4. May 14, 2019
  5. May 06, 2019
  6. May 05, 2019
  7. May 02, 2019
  8. May 01, 2019
  9. Apr 30, 2019
  10. Apr 18, 2019
  11. Apr 16, 2019
    • Lev Zlotnik's avatar
      LSTM: Modular implementation + Post-Train Quantization Sample (#196) · a3c8d86f
      Lev Zlotnik authored
      * Introduce a modular, Python-level implementation of LSTM/LSTMCell
        using existing PyTorch nn.Modules as building blocks
      * This allows quantization of weights and internal activations of
        LSTM layers using the existing Quantizer. 
        (In the PyTorch implementation of RNN/LSTM only the weights are 
        exposed at the Python level, whereas the internal activations are 
        "hidden" in C++ code.)
      * Supports stacked (multi-layer) and bi-directional LSTM
      * Implemented conversion functions from PyTorch LSTM module to
        our LSTM module and vice-versa
      * Tests for modular implementation correctness and for conversions
      * Jupyter notebook showing post-training quantization of a language
        model
      a3c8d86f
    • Lev Zlotnik's avatar
  12. Apr 14, 2019
  13. Apr 11, 2019
    • Guy Jacob's avatar
      save_checkpoint(): Save dict of user values (Breaking) (#219) · 158602c5
      Guy Jacob authored
      * Replace the optional 'best_top1' parameter with a generic
        optional dict which the caller can populate as needed.
      * Saved in the checkpoint under the key 'extras'
      Unverified
      158602c5
    • Guy Jacob's avatar
      Add functionality to log values of buffers in a model (#220) · 2b6b7251
      Guy Jacob authored
      * In all logger types (PythonLogger, TensorBoardLogger, CSVLogger)
      * Exact behavior varies per logger type and documented in the code.
      * To enable in CSVLogger, changed its API to take a file name prefix
        (optionally empty) instead of the full name, and use a hard-coded 
        name for logging weights sparsity.
      * Also fixed signature of log_training_progress in base DataLogger
        class to match the signature used in the sub-classes.
      Unverified
      2b6b7251
  14. Apr 09, 2019
    • Neta Zmora's avatar
      SummaryGraph - fix MACs calculation for grouped-convolutions · 1a8c6bb8
      Neta Zmora authored
      Also added tests
      1a8c6bb8
    • Bar's avatar
      Relaxation of the SummaryGraph API (#212) · d08c3734
      Bar authored
      This commit simplifies the SummaryGraph API,
      by removing from the client to burden to handle 
      the differences between models with/without 
      DataParallel layers.
      
      DataParallel layers in PyTorch change the fully-qualified
      names (FQNs) of PyTorch modules.  A module's FQN
      unambiguously identifies a module within a model, by 
      encoding the path to the module from the root of the 
      model.  For example, ```module.layer2.1.conv1``` and 
      ```module.layer2.0.conv1``` are FQNs of two different
      modules named ```conv1``` in some module.  
      Because a module's FQN reflects the module's hierarchy,
      adding/removing a DataParallel node also changes its FQN.
      
      Distiller uses FQNs to refer to modules and parameters 
      (e.g. from YAML files), and non-functional changes to the 
      model hierarchy, such as using DataParallel modules are
      handled by converting FQNs using `
      ``utils.{de,}normalize_module_name()```.
      
      Before this commit, the SummaryGraph API assumed that 
      the API client will convert layers names using 
      ```utils.normalize_module_name()``` before invoking the API.
      This led to needlessly verbose client code, which was also
      error-prone and harder to read and maintain.
      This commit fixes these short-comings by relaxing the API, 
      and handling the FQNN naming differences internally.
      
      The thinning implementation is simplified somewhat
      by refactoring to the new APIs lenient requirements.
      
      Added named_params_layers method to SummaryGraph
      that yields a 3-tuple of: layer name, param name, and param.
      When using the new method, summary graph communicates the
      true layer name in respect to the model it was initiated with.
      d08c3734
  15. Apr 08, 2019
    • Neta Zmora's avatar
      Documentation: add missing images · ce082d5e
      Neta Zmora authored
      Unnfortunately, we maintain 2 copies of documentation images (one
      for the documentation source; another for the generated documentation).
      We need to solve this as it makes the repository size unproportionally
      large.
      ce082d5e
    • Neta Zmora's avatar
      Refine pruning logic (#222) · 816a943d
      Neta Zmora authored
      Add finer control over the pruning logic, to accommodate more pruning
      use-cases.
      The full description of the new logic is available in the updated [documentation
      of the CompressionScheduler](https://nervanasystems.github.io/distiller/schedule.html#pruning-fine-control), which is also part of this PR.
      
      In this PR:
      
      * Added a new callback to the CompressionScheduler:
      compression_scheduler.before_parameter_optimization which is invoked
      after the gradients are are computed, but before the weights are updated
      by the optimizer.
      
      * We provide an option to mask the gradients, before the weights are updated by the optimizer. 
      We register to the parameter backward hook in order to mask the gradients.
      This gives us finer control over the parameter updates.
      
      * Added several DropFilter schedules.
      DropFilter is a method to regularize networks, and it can also be
      used to "prepare" a network for permanent filter pruning.
      
      *Added documentation of pruning fine-control
      Unverified
      816a943d
    • tacker-oh's avatar
      Proper handling of 0s in DoReFa 1-bit weights (#205) · 87d7c6ce
      tacker-oh authored
      Fixes #198.
      Previously 0s were being mapped to 0, effectively yielding a third 
      quantization level. This fix maps 0s to 1.
      87d7c6ce
    • Lev Zlotnik's avatar
    • Neta Zmora's avatar
      Fix issue #213 (#221) · 73b3b3cf
      Neta Zmora authored
      Dropout layers were not handled properly in SummaryGraph, and
      caused the indexing of layer names to change.
      The root cause is that in ONNX uses the same node name for
      Dropout and Linear layers that are processed in sequence.
      ONNX nodes can be identified by three components: the ONNX 
      node name,  type, and instance.
      In SummaryGraph we ignore the node type when naming a node.
      Specifically in AlexNet, nodes the Dropout layers before a Linear
      layer have the same node name and instance, and are only distinguished
      by their type.  SummaryGraph, ignorant of the type, skipped the Dropout
      layers and gave SG nodes the wrong name.  Thus 'classifier.0', which is
      a Dropout node, became a Linear node.
      The fix is not to ignore duplicate (node name, instance) pairs
      by incrementing the instance.
      Unverified
      73b3b3cf
Loading