-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
44 lines (36 loc) · 857 Bytes
/
config.py
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
import torch
import sys
print(f"python_version: {sys.version}")
print(f"torch_version: {torch.__version__}")
print(f"device_name: {torch.cuda.get_device_name()}")
# *** PATHS ***
DATA_DIR = "data"
VOCAB_PATH = "/media/SSD2/LLM/data/vocab.json"
ENCODING = "utf-8"
TOKENS_DIR = "/media/SSD2/LLM/data/tokens"
MODEL_DIR = "models"
# *** DEVICE ***
device_name = "cpu"
if torch.cuda.is_available():
device_name = "cuda"
DEVICE = torch.device(device_name)
print(f"using device: {DEVICE}")
# *** TRAIN ***
block_size = 1024 # 1024
batch_size = 4 # 32
total_batch_size = 131072 # in tokens
betas = (0.9, 0.95)
eps = 1e-8
weight_decay = 0.1
EPOCHS = 2
EVAL_FREQ = 10
SAVE_FREQ = 50
max_lr = 6e-4
min_lr = max_lr * 0.1
# *** MODEL ***
VOCAB_SIZE = 30_000
N_BLOCK = 12
N_HEAD = 12
N_EMBD = 768
# *** OTHER ***
torch.set_float32_matmul_precision('high')