-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.py
More file actions
86 lines (65 loc) · 1.6 KB
/
config.py
File metadata and controls
86 lines (65 loc) · 1.6 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# config.py
import torch
# -------------------------
# Training parameters
# -------------------------
batch_size = 8
ctx_len = 2048
eval_interval = 20
grad_accum = 16
max_grad_norm=1.0
lr = 0.00015
min_lr = 2e-7
dropout = 0.05
max_iters = 10000
eval_iters = 20
warmup_iters = 200
resume = True
res_path = ""
data_dir = 'tokenized_data'
info_levl=1 #1:model parameters and Optimizer and MoE / Router Info and mhc / mhc Info.2:ALL
# -------------------------
# Model parameters
# -------------------------
n_embd = 1536
n_head = 16
n_layer = 6
n_experts = 8
num_exp=2
shared_experts=1
use_expert_bias = 'True'
types = ['moe']
attention_types = ['Sparse']
hc = 'True'
vocab_size = 50257
init_moe_scaling = 1.25
device = 'cuda'
rms_norm_eps=1e-6
block_size=16
num_tokens_to_keep=128
window_size=128
weight_decay=1e-2
bias=False
# -------------------------
# HC / MHC / Sinkhorn Parameters
# -------------------------
hc_num_streams = 4
hc_num_fracs = 1
hc_disable = False # note: convert string to bool in training code if needed
mhc = 'True'
sinkhorn_iters = 10
sinkhorn_tau = 0.05
mhc_h_res_proj = 'sinkhorn'
cosine_decay = True
# -------------------------
# Neural Sort / Regularization
# -------------------------
ns_steps = 5
ns_eps = 1e-7
ns_coeffs = (3.0, -3.2, 1.2)
v_residual = True
# NSA Branch Configuration
nsa_use_branch1 = 1 # Coarse-grained compression (HCA)
nsa_use_branch2 = 1 # Token selection (CSA)
nsa_use_branch3 = 1 # Sliding window (SWA)
attention_mode = ['SWA', 'SWA', 'CSA', 'HCA', 'CSA', 'HCA']