Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: load the same config from_pretrained and get_sae_config #361

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chanind
Copy link
Collaborator

@chanind chanind commented Nov 5, 2024

Description

This PR unifies the code path for from_pretrained and get_sae_config so the config dict should match, and adds a test asserting this for a jbloom/gpt2 SAE.

Fixes #351

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have not rewritten tests relating to key interfaces which would affect backward compatibility

You have tested formatting, typing and unit tests (acceptance tests not currently in use)

  • I have run make check-ci to check format and linting. (you can run make format to format code if needed.)

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.

Project coverage is 66.16%. Comparing base (b8703fe) to head (84203cd).

Files with missing lines Patch % Lines
sae_lens/toolkit/pretrained_sae_loaders.py 81.81% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #361      +/-   ##
==========================================
- Coverage   66.17%   66.16%   -0.01%     
==========================================
  Files          25       25              
  Lines        3367     3372       +5     
  Branches      429      431       +2     
==========================================
+ Hits         2228     2231       +3     
- Misses       1020     1021       +1     
- Partials      119      120       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@hijohnnylin hijohnnylin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

i tested using my repro code from the issue and it appears to be fixed. you are good to merge.

only thing i noticed during review was that there's a neuronpedia property and also a neuronpedia_id property, both which seem to always return None even if the neuronpedia value is set in the yaml file:

cfg_dict.setdefault("neuronpedia", None)
and
"neuronpedia_id": None,

let me know if i should open a separate issue for that, happy to do it.

@chanind
Copy link
Collaborator Author

chanind commented Nov 5, 2024

I noticed that as well - it looks like the neuronpedia_id property is only set on the config in the SAE, but not in the config_dict that gets returned from SAE.from_pretrained(). I'm not sure what the reason for that is, or if it's simply an oversight. I can add it to the the config_dict so it's set every if that makes more sense. I'm also not sure what the idea with the neuronpedia property is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report] get_sae_config doesn't return the same config as SAE.from_pretrained due to defaulting
2 participants