Delve lets you monitor PyTorch model layer saturation during training
Project description
Delve: Deep Live Visualization and Evaluation
Inspect layer saturation for optimizing your PyTorch 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
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:
Log spectral analysis
Writes the top 5 eigenvalues of each layer to TensorBoard summaries:
stats = CheckLayerSat('runs', layers, 'spectrum')
Other options
Intrinsic dimensionality
View the intrinsic dimensionality of models in realtime:
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file delve-0.1.9.tar.gz
.
File metadata
- Download URL: delve-0.1.9.tar.gz
- Upload date:
- Size: 12.0 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcdfdc9270652edaf4f5f95cb74e97373955c1a31f544bc668f6c5ae74084fd3 |
|
MD5 | 2c539aa68bd4cac2f1d819fae2ee0fba |
|
BLAKE2b-256 | df943b2eb895372adb835677a0afa447a10b15317cdc4314f2b9ba8c3c4a7978 |
Provenance
File details
Details for the file delve-0.1.9-py2.py3-none-any.whl
.
File metadata
- Download URL: delve-0.1.9-py2.py3-none-any.whl
- Upload date:
- Size: 15.1 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c8febbc81b11759941eaa892d8f390136d09e98b9a438db8e32089858486bc5 |
|
MD5 | 4ea85caaeea425175c861994966c5af8 |
|
BLAKE2b-256 | 2717cf39d1a6ac159734ca9d2797ae43b0475f14ca10035a18a2ad8614589618 |