-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathtrain.py
More file actions
49 lines (44 loc) · 1.01 KB
/
train.py
File metadata and controls
49 lines (44 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# %%
from utils import *
from trainer import Trainer
# %%
device = 'cuda:0'
base_model = HookedTransformer.from_pretrained(
"gemma-2-2b",
device=device,
)
chat_model = HookedTransformer.from_pretrained(
"gemma-2-2b-it",
device=device,
)
# %%
all_tokens = load_pile_lmsys_mixed_tokens()
# %%
default_cfg = {
"seed": 49,
"batch_size": 4096,
"buffer_mult": 128,
"lr": 5e-5,
"num_tokens": 400_000_000,
"l1_coeff": 2,
"beta1": 0.9,
"beta2": 0.999,
"d_in": base_model.cfg.d_model,
"dict_size": 2**14,
"seq_len": 1024,
"enc_dtype": "fp32",
"model_name": "gemma-2-2b",
"site": "resid_pre",
"device": "cuda:0",
"model_batch_size": 4,
"log_every": 100,
"save_every": 30000,
"dec_init_norm": 0.08,
"hook_point": "blocks.14.hook_resid_pre",
"wandb_project": "YOUR_WANDB_PROJECT",
"wandb_entity": "YOUR_WANDB_ENTITY",
}
cfg = arg_parse_update_cfg(default_cfg)
trainer = Trainer(cfg, base_model, chat_model, all_tokens)
trainer.train()
# %%