Skip to content

Commit 4d2d46b

Browse files
authored
Merge pull request #48 from Noam-Diamant/fixes
added load_dictionary to readme.md in order to load different SAEs
2 parents 61ac634 + 6ca39b5 commit 4d2d46b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ We also provide a [demonstration](https://github.com/adamkarvonen/dictionary_lea
1515

1616
# Using trained dictionaries
1717

18-
You can load and used a pretrained dictionary as follows
18+
You can load and used a pretrained dictionary as follows.
19+
Also, look in utils.py to see more useful functions in order to load SAEs.
1920
```python
20-
from dictionary_learning import AutoEncoder
21+
from dictionary_learning import AutoEncoder, utils
2122

22-
# load autoencoder
23+
# load autoencoder (This specifically loads standard SAE, not other architectures)
2324
ae = AutoEncoder.from_pretrained("path/to/dictionary/weights")
2425

26+
# or you can use this method from utils to load any architecture
27+
ae, config = utils.load_dictionary("path/to/dictionary/weights", device=device)
28+
2529
# get NN activations using your preferred method: hooks, transformer_lens, nnsight, etc. ...
2630
# for now we'll just use random activations
2731
activations = torch.randn(64, activation_dim)

0 commit comments

Comments
 (0)