Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,27 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
---
|
4 |
+
Linear probe checkpoints for https://footprints.baulab.info
|
5 |
+
|
6 |
+
To load a Llama-2-7b checkpoint at layer 0 and target index -3:
|
7 |
+
|
8 |
+
```
|
9 |
+
import torch
|
10 |
+
import torch.nn as nn
|
11 |
+
from huggingface_hub import hf_hub_download
|
12 |
+
|
13 |
+
class LinearModel(nn.Module):
|
14 |
+
def __init__(self, input_size, output_size, bias=False):
|
15 |
+
super(LinearModel, self).__init__()
|
16 |
+
self.fc = nn.Linear(input_size, output_size, bias=bias)
|
17 |
+
def forward(self, x):
|
18 |
+
output = self.fc(x)
|
19 |
+
return output
|
20 |
+
|
21 |
+
checkpoint_path = hf_hub_download(
|
22 |
+
repo_id="sfeucht/footprints",
|
23 |
+
filename="llama-2-7b/layer0_tgtidx-3.ckpt"
|
24 |
+
)
|
25 |
+
probe = LinearModel(4096, 32000)
|
26 |
+
probe.load_state_dict(torch.load(checkpoint_path, map_location=torch.device('cpu')))
|
27 |
+
```
|