Package to localize torch deep learning models
Project description
DeepLocalizer: Quickly find functional specialization in deep neural networks.
Extends The LLM Language Network: A Neuroscientific Approach for Identifying Causally Task-Relevant Units and Brain-like functional specialization emerges spontaneously in deep neural networks to other models and data.
Examples:
Roadmap
- Replicate some parts of original paper (https://github.com/xnought/paper-implement/tree/main/language_network)
- Write code from scratch to do analysis on face with resnet
- Set up face localizer example w/ goal of applying to a resnet model
- 5k positive (faces) from CelebA
- 5k negative (objects) from COCO
- Extract activations from the resnet model
- test track the activations
- store activations on disk
- Contrast positive vs negative activations
- Ablation w/ statistical tests on resnet
- write code to ablate torch models easily
- ablate given the top percent face activations
- Compare performance after ablation
- Set up face localizer example w/ goal of applying to a resnet model
- Write general API from most helpful functions so others can easily use the library
- Activation computation
- Analysis computation
- Top percent global
- Visualizations
- Ablate model with the top percent
- Compute statistics on ablated model
- Write report on the resnet example and if localization seems to work and what evidence (here -> https://www.donnybertucci.com/project/deeplocalizer)
Usage
API
See resnet34_example.ipynb for doing localization on a torch model with a custom dataset/task.
uv add deeplocalizer
Or if you are old school
Install
pip install deeplocalizer
Development
cd deeplocalizer # this git repo
Make sure to have https://docs.astral.sh/uv/ installed.
Install and Run
uv sync
uv run deeplocalizer/deeplocalizer.py
or run an example python notebook within the .env generated.
References
papers
code/datasets
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deeplocalizer-0.0.1.tar.gz.
File metadata
- Download URL: deeplocalizer-0.0.1.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
308f01f9e2a07df76f077562621b30ce92d8573ba7cd065cbcdf4033c1187599
|
|
| MD5 |
a050a32396392889e08a6209ea272081
|
|
| BLAKE2b-256 |
42f8bbd6f70292a2d1ff1953c01b911f1cb2c424fdcc5dc241d826f156a376cb
|
File details
Details for the file deeplocalizer-0.0.1-py3-none-any.whl.
File metadata
- Download URL: deeplocalizer-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7a3789ec7a95326ea6f91e66ad2eb7b3c610a53b4c16b55e4013fc77b58b3fd
|
|
| MD5 |
cdd14a5f388b444700c71076a4a23654
|
|
| BLAKE2b-256 |
6f186f0a99490c79f97c4c70ca18417675a22fec263e183915a774b24affe5eb
|