Quickly find functional specialization in PyTorch models.
Extends The LLM Language Network: A Neuroscientific Approach for Identifying Causally Task-Relevant Units to other models and data.
Examples:
Tasks are just pandas dataframes with a data, positive, and validation columns. Each row is a different data point.
See face_data_viewer.ipynb to see a real example of a face localizer data (face images from CelebA vs. objects images from COCO).
What do the columns mean?
datais the data itself (eg text) or points to data (eg image filename)positiveisTruefor the task andFalsefor the control (eg face images haveTrueand control images haveFalse)validationis technically optional. If you want to notate some rows to only be used later on to test performance and not for the main localization, you can indicate a subset of the rows asTrue. The main dataset used for localization is thenFalse.
Again see face_data_viewer.ipynb if you're still confused.
Install
uv add deeplocalizeror
pip install deeplocalizerAPI Usage
See exact functions at Docs and see resnet34_example.ipynb for an example of using those functions.
cd deeplocalizer # this git repoMake sure to have https://docs.astral.sh/uv/ installed.
Install and Run
uv sync
uv run deeplocalizer/deeplocalizer.pyor run an example python notebook within the .env generated.
Run Docs
uv run mkdocs servepapers
code/datasets