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

add SAELens as a library ⚡ #826

Merged
merged 1 commit into from
Aug 1, 2024
Merged

add SAELens as a library ⚡ #826

merged 1 commit into from
Aug 1, 2024

Conversation

Vaibhavs10
Copy link
Member

Couple of quick comments:

  1. The way that snippets work are a bit different in the library as they work via this yaml file and load it directly via a snapshot download: https://github.com/jbloomAus/SAELens/blob/fe987f1d1b06a5f0116e390efc87a69f59e04473/sae_lens/toolkit/pretrained_saes.py#L20
    Hence, the snippet doesn't really use the repo name directly, ref: https://jbloomaus.github.io/SAELens/

  2. Checking how to make the download counts work right now.

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Looks good to me for now. About code snippet, it is not an obligation to have one. If there is no easy way to describe/compute a code snippet, it's fine not the have one.

Regarding download count, I'd suggest

            countDownloads: `path_filename:"cfg" AND path_extension:"json"`,

to count downloads on all */cfg.json since they are downloaded one by one for what I understand from download_sae_from_hf.

Last request, could you open a PR to add library_name: saelens in the model card metadata of jbloom/GPT2-Small-SAEs-Reformatted.

prettyLabel: "SAELens",
repoName: "SAELens",
repoUrl: "https://github.com/jbloomAus/SAELens",
filter: false,
Copy link
Member Author

Choose a reason for hiding this comment

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

QQ: @Wauplin - do you have any recommendations on the best way to track downloads in this scenario: https://huggingface.co/jbloom/GPT2-Small-SAEs-Reformatted/tree/main

Copy link
Contributor

Choose a reason for hiding this comment

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

Depends if the general use case is to load only one block or all blocks at once.

  • if only one block, better to do as I suggested in add SAELens as a library ⚡ #826 (review)
  • if all blocks are generally instanciated at once, then it's better to count downloads only on the first block path: "blocks.0.hook_resid_pre/cfg.json"

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm afraid it is a bit more complicated, on more newer repos (cannot link them atm as they are not public yet) they might just have an npz file. The usage is more layer wise so I think the former suggestion for npz, cfg, json makes more sense.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I think the each block provides a different lens so they are used independently. But the structure does not appear to be standardized, so I would merge as is for now (without download counts) and clarify when we can.

Copy link
Member Author

Choose a reason for hiding this comment

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

okay, the downloads would need more time to standardise. Given this unblocks a release happening soon. Is it okay if we merge as is for now and revisit in a day when we have more clarity.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fine for me!

prettyLabel: "SAELens",
repoName: "SAELens",
repoUrl: "https://github.com/jbloomAus/SAELens",
filter: false,
Copy link
Member

Choose a reason for hiding this comment

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

Yes, I think the each block provides a different lens so they are used independently. But the structure does not appear to be standardized, so I would merge as is for now (without download counts) and clarify when we can.

@Vaibhavs10
Copy link
Member Author

Opened PRs and some are already merged!

@Wauplin
Copy link
Contributor

Wauplin commented Jul 31, 2024

Opened PRs and some are already merged!

Do you have examples of merged ones? I can't find any models on https://huggingface.co/models?other=saelens

Other than that, feel free to merge.

@Vaibhavs10
Copy link
Member Author

It has good number of examples now! 👍
https://huggingface.co/models?other=saelens

@Vaibhavs10 Vaibhavs10 merged commit 5ef3b16 into main Aug 1, 2024
3 of 5 checks passed
@Vaibhavs10 Vaibhavs10 deleted the vb/add-saelens-library branch August 1, 2024 13:12
xenova added a commit that referenced this pull request Aug 5, 2024
Follow-up to #826, and
(currently) an intermediate PR before `.from_pretrained` support is
added for any model on the HF Hub. See
jbloomAus/SAELens#234 (comment)
for additional discussion.
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.

3 participants