Skip to main content

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
  • 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

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.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

deeplocalizer-0.0.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deeplocalizer-0.0.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file deeplocalizer-0.0.0.tar.gz.

File metadata

  • Download URL: deeplocalizer-0.0.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for deeplocalizer-0.0.0.tar.gz
Algorithm Hash digest
SHA256 0a0113cd9640e3375860c853645438dc9bc12bc7d6932983ad17bba944a8db5b
MD5 fc3c4fbdf67d7eb26e9d2340a132ed01
BLAKE2b-256 911f54f726d6e261320c23b4918ac0606c5a9bb0815b639a373c261f47b1a889

See more details on using hashes here.

File details

Details for the file deeplocalizer-0.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for deeplocalizer-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b820bb65c23fb262b8995d44d41cf5db3edd6906a84eefffff5e196b7298b597
MD5 24d9f29b4bcc092d856fa63fecf79cec
BLAKE2b-256 daa49da579e19dd648f5dd66ef0edbe4227a73eff1c4a2b31f9462b3d40ec72a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page