Skip to main content

Delve lets you monitor PyTorch model layer saturation during training

Project description

Delve: Deep Live Visualization and Evaluation

PyPI version Build Status

Inspect layer saturation for optimizing your PyTorch or Keras models.

Delve is a Python package for visualizing deep learning model training.

Use Delve if you need a lightweight PyTorch extension that:

  • Plots live statistics of network activations to TensorBoard
  • Performs spectral analysis to identify layer saturation for network pruning
  • Is easily extendible and configurable

Motivation

Designing a deep neural network involves optimizing over a wide range of parameters and hyperparameters. Delve allows you to visualize your layer saturation during training so you can grow and shrink layers as needed.

Demo

live layer saturation demo

example_fc.gif

Getting Started

pip install delve

Layer Saturation

Pass a PyTorch model or Linear layers to CheckLayerSat:

from delve import CheckLayerSat

model = TwoLayerNet() # PyTorch network
stats = CheckLayerSat('runs', model) #logging directory and input

... # setup data loader

for i, data in enumerate(train_loader):    
    stats.saturation() # output saturation

Only fully-connected and convolutional layers are currently supported.

To log the saturation to console, call stats.saturation(). For example:

Regression - SixLayerNet - Hidden layer size 10                        loss=0.231825:  68%|████████████████████▎         | 1350/2000 [00:04<00:02, 289.30it/s]│
linear1:  90%|█████████████████████████████████▎   | 90.0/100 [00:00<00:00, 453.47it/s]│
linear2:  18%|██████▊                               | 18.0/100 [00:00<00:00, 90.68it/s]│
linear3:  32%|███████████▊                         | 32.0/100 [00:00<00:00, 161.22it/s]│
linear4:  32%|███████████▊                         | 32.0/100 [00:00<00:00, 161.24it/s]│
linear5:  28%|██████████▎                          | 28.0/100 [00:00<00:00, 141.11it/s]│
linear6:  90%|██████████████████████████████████▏   | 90.0/100 [00:01<00:00, 56.04it/s]

Optimize neural network topology

Ever wonder how big your fully-connected layers should be? Delve helps you visualize the effect of modifying the layer size on your layer saturation.

For example, see how modifying the hidden layer size of this network affects the second layer saturation but not the first. Multiple runs show that the fully-connected "linear2" layer (light blue is 256-wide and orange is 8-wide) saturation is sensitive to layer size:

saturation

saturation

Log spectral analysis

Writes the top 5 eigenvalues of each layer to TensorBoard summaries:

stats = CheckLayerSat('runs', layers, 'spectrum')

Other options spectrum

Intrinsic dimensionality

View the intrinsic dimensionality of models in realtime:

intrinsic_dimensionality-layer2

This comparison suggests that the 8-unit layer (light blue) is too saturated and that a larger layer is needed.

Why this name, Delve?

delve (verb):

  • reach inside a receptacle and search for something
  • to carry on intensive and thorough research for data, information, or the like

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

delve-0.1.10.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

delve-0.1.10-py2.py3-none-any.whl (15.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file delve-0.1.10.tar.gz.

File metadata

  • Download URL: delve-0.1.10.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.13.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.7.2

File hashes

Hashes for delve-0.1.10.tar.gz
Algorithm Hash digest
SHA256 70b463aef5d715b5b87095091ff4242e5f25a0f5a0e1bf2d4a752a0478239c15
MD5 5aa040b6148fe0a679352fabcbccb1da
BLAKE2b-256 ff6391c3cccc95d370a7695c724ea10b1bcf99951532169799a9395befbc6034

See more details on using hashes here.

Provenance

File details

Details for the file delve-0.1.10-py2.py3-none-any.whl.

File metadata

  • Download URL: delve-0.1.10-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.13.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.7.2

File hashes

Hashes for delve-0.1.10-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 93cdd1b06eec685861d1fa6fb89d45682b03a8ee9bde108a06ea753736fdec4f
MD5 60fc15dfd28f40a7ea0ed7da21cb93da
BLAKE2b-256 6d7038fb0418dac1ad6cc2dae955bd891395bc6572c147c8d8148fbbdfcb2231

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page