https://github.com/adonath/clouseau
π΅οΈββοΈπA library independent forward pass inspector for neural netsππ΅οΈββοΈ
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
βCITATION.cff file
-
βcodemeta.json file
Found codemeta.json file -
β.zenodo.json file
Found .zenodo.json file -
βDOI references
-
βAcademic publication links
-
βAcademic email domains
-
βInstitutional organization owner
-
βJOSS paper metadata
-
βScientific vocabulary similarity
Low similarity (12.3%) to scientific vocabulary
Keywords
Repository
π΅οΈββοΈπA library independent forward pass inspector for neural netsππ΅οΈββοΈ
Basic Info
- Host: GitHub
- Owner: adonath
- License: bsd-3-clause
- Language: Python
- Default Branch: main
- Homepage: https://adonath.github.io/clouseau/
- Size: 921 KB
Statistics
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 2
Topics
Metadata Files
README.md
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
bash
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:
```python 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[1]), jax.nn.relu, eqx.nn.Linear(50, 10, keys[2]), jax.nn.sigmoid, ]) x = jax.random.normal(jax.random.PRNGKey(0), (764,))
def is_leaf(path, node): return isinstance(node, jax.Array) or node in (jax.nn.relu, jax.nn.sigmoid)
with inspector.tail(model, isleaf=isleaf) as m: m(x) ```
Then in an interactive session inspect the recorded activations:
```python from clouseau import inspector
inspector.magnify(".clouseau/activations-000.safetensors") ```
Which will print a tree view of the arrays in the file. Alternatively you can use the command line interface like so:
``` clouseau show --filename activations.safetensors --key-pattern "0."
```
Where --key-pattern will accept any regular expression to match the path of array leave in the file.
PyTorch Example
```python 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.
Owner
- Name: Axel Donath
- Login: adonath
- Kind: user
- Location: Cambridge, MA
- Company: Center for Astrophysics | Havard & Smithonian
- Website: https://axeldonath.com
- Repositories: 68
- Profile: https://github.com/adonath
I'm a Postdoc researcher at Center for Astrophysics. I work on statistical methods for analysis of low counts astronomical data.
GitHub Events
Total
- Release event: 2
- Watch event: 2
- Delete event: 2
- Public event: 1
- Push event: 36
- Pull request event: 5
- Create event: 4
Last Year
- Release event: 2
- Watch event: 2
- Delete event: 2
- Public event: 1
- Push event: 36
- Pull request event: 5
- Create event: 4
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 0
- Total pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: less than a minute
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: less than a minute
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- adonath (6)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 14 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 1
- Total maintainers: 1
pypi.org: clouseau
A library independent forward pass inspector for neural nets
- Homepage: https://adonath.github.io/clouseau/
- Documentation: https://adonath.github.io/clouseau/
- License: bsd-3-clause
-
Latest release: 0.2
published 10 months ago
Rankings
Maintainers (1)
Dependencies
- actions/setup-python v5 composite
- astral-sh/setup-uv v2 composite
- ./.github/actions/setup-python-env * composite
- actions/cache v4 composite
- actions/checkout v4 composite
- codecov/codecov-action v4 composite
- ./.github/actions/setup-python-env * composite
- actions/checkout v4 composite
- actions/download-artifact v4 composite
- actions/upload-artifact v4 composite
- actions/checkout v4 composite
- safetensors >=0.5.2
- treescope >=0.1.8