-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: Quality of Life Refactor of SAE Lens adding SAE Anal…
…ysis with HookedSAETransformer and some other breaking changes. (#162) * move HookedSAETransformer from TL * add tests * move runners one level up * fix docs name * trainer clean up * create training sae, not fully seperate yet * remove accidentally commited notebook * commit working code in the middle of refactor, more work to do * don't use act layers plural * make tutorial not use the activation store * moved this file * move import of toy model runner * saes need to store at least enough information to run them * further refactor and add tests * finish act store device rebase * fix config type not caught by test * partial progress, not yet handling error term for hooked sae transformer * bring tests in line with trainer doing more work * revert some of the simplification to preserve various features, ghost grads, noising * hooked sae transformer is working * homogenize configs * re-enable sae compilation * remove old file that doesn't belong * include normalize activations in base sae config * make sure tutorial works * don't forget to update pbar * rename sparse autoencoder to sae for brevity * move non-training specific modules out of training * rename to remove _point * first steps towards better docs * final cleanup * have ci use same test coverage total as make check-ci * clean up docs a bit --------- Co-authored-by: ckkissane <[email protected]>
- Loading branch information
Showing
88 changed files
with
5,831 additions
and
8,947 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,7 +70,7 @@ jobs: | |
run: poetry run pyright | ||
- name: Run Unit Tests | ||
# Would use make, but want cov report in xml format | ||
run: poetry run pytest -v --cov=sae_lens/training/ --cov-report=term-missing --cov-branch tests/unit --cov-report=xml | ||
run: poetry run pytest -v --cov=sae_lens/ --cov-report=term-missing --cov-branch tests/unit --cov-report=xml | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# API | ||
|
||
::: sae_lens |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,32 @@ | ||
__version__ = "2.1.3" | ||
|
||
from .training.activations_store import ActivationsStore | ||
from .training.cache_activations_runner import CacheActivationsRunner | ||
from .training.config import ( | ||
|
||
from .analysis.hooked_sae_transformer import HookedSAETransformer | ||
from .cache_activations_runner import CacheActivationsRunner | ||
from .config import ( | ||
CacheActivationsRunnerConfig, | ||
LanguageModelSAERunnerConfig, | ||
PretokenizeRunnerConfig, | ||
) | ||
from .training.evals import run_evals | ||
from .training.lm_runner import SAETrainingRunner | ||
from .training.pretokenize_runner import pretokenize_runner | ||
from .training.session_loader import LMSparseAutoencoderSessionloader | ||
from .training.sparse_autoencoder import SparseAutoencoder | ||
from .evals import run_evals | ||
from .pretokenize_runner import pretokenize_runner | ||
from .sae import SAE, SAEConfig | ||
from .sae_training_runner import SAETrainingRunner | ||
from .training.activations_store import ActivationsStore | ||
from .training.training_sae import TrainingSAE, TrainingSAEConfig | ||
|
||
__all__ = [ | ||
"SparseAutoencoder", | ||
"SAE", | ||
"SAEConfig", | ||
"TrainingSAE", | ||
"TrainingSAEConfig", | ||
"HookedSAETransformer", | ||
"ActivationsStore", | ||
"LanguageModelSAERunnerConfig", | ||
"SAETrainingRunner", | ||
"CacheActivationsRunnerConfig", | ||
"CacheActivationsRunner", | ||
"PretokenizeRunnerConfig", | ||
"pretokenize_runner", | ||
"LMSparseAutoencoderSessionloader", | ||
"run_evals", | ||
] |
Oops, something went wrong.