https://github.com/adonath/clouseau

πŸ•΅οΈβ€β™‚οΈπŸ”ŽA library independent forward pass inspector for neural netsπŸ”ŽπŸ•΅οΈβ€β™‚οΈ

https://github.com/adonath/clouseau

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

debugging jax pytorch safetensors
Last synced: 6 months ago · JSON representation

Repository

πŸ•΅οΈβ€β™‚οΈπŸ”ŽA library independent forward pass inspector for neural netsπŸ”ŽπŸ•΅οΈβ€β™‚οΈ

Basic Info
Statistics
  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 2
Topics
debugging jax pytorch safetensors
Created about 1 year ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License

README.md

Clouseau: the forward pass inspector

Release Build status codecov Commit activity License

Clouseau Banner

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

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

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 14 Last month
Rankings
Dependent packages count: 9.3%
Stargazers count: 30.1%
Average: 30.8%
Forks count: 31.5%
Dependent repos count: 52.2%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/actions/setup-python-env/action.yml actions
  • actions/setup-python v5 composite
  • astral-sh/setup-uv v2 composite
.github/workflows/main.yml actions
  • ./.github/actions/setup-python-env * composite
  • actions/cache v4 composite
  • actions/checkout v4 composite
  • codecov/codecov-action v4 composite
.github/workflows/on-release-main.yml actions
  • ./.github/actions/setup-python-env * composite
  • actions/checkout v4 composite
  • actions/download-artifact v4 composite
  • actions/upload-artifact v4 composite
.github/workflows/validate-codecov-config.yml actions
  • actions/checkout v4 composite
pyproject.toml pypi
  • safetensors >=0.5.2
  • treescope >=0.1.8