TransformerLensOrg / TransformerLens

A library for mechanistic interpretability of GPT-style language models
https://transformerlensorg.github.io/TransformerLens/
MIT License
1.17k stars 241 forks source link

Add tests for hook point add hook #617

Closed anthonyduong9 closed 1 month ago

anthonyduong9 commented 1 month ago

Description

Adds tests for HookPoint.add_hook(). This makes it safer to change the method. @VasilGeorgiev39 wrote a bug while refactoring the method, and it wasn't caught by tests.

Fixes # https://github.com/TransformerLensOrg/TransformerLens/issues/540

Type of change

Please delete options that are not relevant.

Screenshots

Please attach before and after screenshots of the change if applicable.

Checklist:

bryce13950 commented 1 month ago

Thank you very much for adding this! I really appreciate it. If you are interested in helping a bit more, I would be very happy to help you find something to do. If you want to improve test coverage then there is a lot to be done there ehttps://transformerlensorg.github.io/TransformerLens/_static/coverage/. The report at the time of writing this is for 1.19, and 2.0 will be put up tomorrow, which will affect it a bit. Regardless, there is a lot of work that needs to be done there. If you want to do something a bit more interesting, then there is always the potential to add support for new models, and a whole bunch of additional things that are in the pipeline. If you are interested, and you need direction, reach out to me on slack. I am on the Open Source Mechanistic Interpretability channel as Bryce Meyer.