Clouseau: the forward pass inspector
A library independent forward pass inspector for neural nets. The tool is designed to be used with PyTorch and Jax (others libraries might come later...). It allows you to register hooks for the forward pass of a model, and write the forward pass activations to a file for later inspection. It is useful for debugging models or transitioning models from one framework to another and checking their equivalence at any stage.
Installation
pip install clouseau
Usage
Jax / Equinox Example
You can use the inspector as a context manager to record the forward pass of a model. The following example shows how to use the inspector with a model from the Equinox library:
import jax
import equinox as eqx
from clouseau import inspector
keys = jax.random.split(jax.random.PRNGKey(918832), 3)
model = eqx.nn.Sequential([
eqx.nn.Linear(764, 100, keys[0]),
jax.nn.relu,
eqx.nn.Linear(100, 50, keys[0]),
jax.nn.relu,
eqx.nn.Linear(50, 10, keys[0]),
jax.nn.sigmoid,
])
x = jax.random.normal(jax.random.PRNGKey(0), (764,))
with inspector.tail(model, path="activations.safetensors") as m:
m(x)
Then in an interactive session inspect the recorded activations:
from clouseau import inspector
inspector.magnify("activations.safetensors")
Which will open the file and generate a hierachical treescope view of the activations.
PyTorch Example
from torch import nn
from clouseau import inspector
model = nn.Sequential({
"dense1": nn.Linear(764, 100),
"act1": nn.ReLU(),
"dense2": nn.Linear(100, 50),
"act2": nn.ReLU(),
"output": nn.Linear(50, 10),
"outact": nn.Sigmoid(),
})
x = torch.randn((764,))
with inspector.tail(model) as m:
m(x)
For more advanced usage including filtering layer types, please refer to the documentation.
Metadata
Release files for clouseau 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| clouseau-0.2.tar.gz | 9.3 kB | Without provenance | Details for clouseau-0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| clouseau-0.2-py3-none-any.whl | Python 3 | none | any | Details for clouseau-0.2-py3-none-any.whl |
Total release size: 18.3 kB
Release files / clouseau-0.2.tar.gz
| Download URL | clouseau-0.2.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
41857c84304ac9a49b605a08d47ead5f5f8ecdec3d40ae984a43610d3feec947
|
|
BLAKE2b-256 checksum How to use checksums |
c2abb6a398d978295171904f8cf455a04c84be5b0840e9cd24cdb2b1beb01328
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Release files / clouseau-0.2-py3-none-any.whl
| Download URL | clouseau-0.2-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d67f0fadfb1705d1cb95c1bf4f1c77e6431fe821d8a3142065a2c6876ff101c
|
|
BLAKE2b-256 checksum How to use checksums |
f934d1a68690921065102576bf9a6314f5954d100ac0d6b432d7956d14281de5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Security for clouseau 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.