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

Change eval batch size #128

Merged
merged 3 commits into from
May 8, 2024
Merged

Conversation

tomMcGrath
Copy link
Contributor

Description

Surfaces extra options for eval step: number of eval batches and number of sequences per eval batch. Adds an optional parameter to activations_store.get_batch_tokens to make this clean: now get_batch_tokens can get a number of sequences that differs from the value defined at init.

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

I've checked these locally but not added tests.

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 May 8, 2024

Codecov Report

Attention: Patch coverage is 57.14286% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 64.58%. Comparing base (1a0619c) to head (0fb19ff).
Report is 1 commits behind head on main.

Files Patch % Lines
sae_lens/training/evals.py 0.00% 2 Missing ⚠️
sae_lens/training/activations_store.py 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #128   +/-   ##
=======================================
  Coverage   64.58%   64.58%           
=======================================
  Files          17       17           
  Lines        1762     1765    +3     
  Branches      291      292    +1     
=======================================
+ Hits         1138     1140    +2     
  Misses        560      560           
- Partials       64       65    +1     

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

@jbloomAus jbloomAus merged commit 758a50b into jbloomAus:main May 8, 2024
4 of 7 checks passed
@@ -106,6 +106,10 @@ class LanguageModelSAERunnerConfig:

dead_feature_threshold: float = 1e-8

# Evals
n_eval_batches: int = 10
n_eval_seqs: int | None = None # useful if evals cause OOM
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: is this the batch size used for eval? If so, this would be clearer named as eval_batch_size to match the naming of store_batch_size and train_batch_size params

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah looks like I must have commented as this was being merged 😅. Not a big issue regardless

Copy link
Owner

Choose a reason for hiding this comment

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

True. Feel free to make a PR for this.

@tomMcGrath
Copy link
Contributor Author

tomMcGrath commented May 8, 2024 via email

@chanind
Copy link
Collaborator

chanind commented May 8, 2024

👍 makes sense!

@jbloomAus
Copy link
Owner

@tomMcGrath @tomMcGrath We previously has "train_batch_size" which is a token batch size for the SAE and a "store batch size" which was a prompts batch size for generating activations. The latter was then reused during evaluations, but we've now seperated them out. I think the following names might be best:

  • train_batch_size_tokens
  • store_batch_size_prompts
  • eval_batch_size_prompts
    I generally like longer names if they are sufficiently clear but will admit these names are long and this could be annoying.

@chanind
Copy link
Collaborator

chanind commented May 8, 2024

That rename makes sense to me, I feel like that makes it more clear what's going on and reduces confusion around the difference between a "batch" of prompts vs tokens

@tomMcGrath
Copy link
Contributor Author

I like that rename - I just put a quick issue in to remind me to do the rename.

tom-pollak pushed a commit to tom-pollak/SAELens that referenced this pull request Oct 22, 2024
* Surface # of eval batches and # of eval sequences

* fix formatting

* fix print statement accidentally left in
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