A collection of infrastructure and tools for research in neural network interpretability.
Jupyter Notebook Other
Clone or download
Latest commit a48792c Aug 15, 2018

README.md

Lucid

PyPI project status Travis build status Code coverage Supported Python version PyPI release version

Lucid is a collection of infrastructure and tools for research in neural network interpretability.

In particular, it provides state of the art implementations of feature visualization techniques, and flexible abstractions that make it very easy to explore new research directions.

Notebooks

Start visualizing neural networks with no setup. The following notebooks run right from your browser, thanks to Colaboratory. It's a Jupyter notebook environment that requires no setup to use and runs entirely in the cloud.

You can run the notebooks on your local machine, too. Clone the repository and find them in the notebooks subfolder. You will need to run a local instance of the Jupyter notebook environment to execute them.

Tutorial Notebooks

Feature Visualization Notebooks

Notebooks corresponding to the Feature Visualization article

Building Blocks Notebooks

Notebooks corresponding to the Building Blocks of Interpretability article





Differentiable Image Parameterizations Notebooks

Notebooks corresponding to the Differentiable Image Parameterizations article

Miscellaneous Notebooks


Recomended Reading

Related Talks



Additional Information

License and Disclaimer

You may use this software under the Apache 2.0 License. See LICENSE.

This project is research code. It is not an official Google product.

Special consideration for TensorFlow dependency

Lucid requires tensorflow, but does not explicitly depend on it in setup.py. Due to the way tensorflow is packaged and some deficiencies in how pip handles dependencies, specifying either the GPU or the non-GPU version of tensorflow will conflict with the version of tensorflow your already may have installed.

If you don't want to add your own dependency on tensorflow, you can specify which tensorflow version you want lucid to install by selecting from extras_require like so: lucid[tf] or lucid[tf_gpu].

In actual practice, we recommend you use your already installed version of tensorflow.

Development

Style guide deviations

We use naming conventions to help differentiate tensors, operations, and values:

  • Suffix variable names representing tensors with _t
  • Suffix variable names representing operations with _op
  • Don't suffix variable names representing concrete values

Usage example:

global_step_t = tf.train.get_or_create_global_step()
global_step_init_op = tf.variables_initializer([global_step_t])
global_step = global_step_t.eval()

Running Tests

Use tox to run the test suite in both Python 2 and Python 3 environments.

To also run slower integration tests (marked with pytest.mark.slow), specify the --run-slow option for pytest, which can be passed through tox like so:

tox -- --run-slow

To run tests only for a specific module, pass a folder to tox: tox tests/misc/io

To run tests only in a specific environment, pass the environment's identifier via the -e flag: tox -e py27.

After adding dependencies to setup.py, run tox with the --recreate flag to update the environments' dependencies.