-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
144 lines (133 loc) · 3.21 KB
/
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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
dataset = "iron"
dataset_seed = 100
cuda_device_num = 1
num_tasks = None
# here is the num_tasks para
if dataset in ["bace", "bbbp", "hiv", "iron"]:
num_tasks = 1
elif dataset == "clintox":
num_tasks = 2
elif dataset == "tox21":
num_tasks = 12
elif dataset == "toxcast":
num_tasks = 617
elif dataset == "sider":
num_tasks = 27
elif dataset == "muv":
num_tasks = 17
else:
num_tasks = -1
# here is the max_len para
smiles_max_len_dict = {
"bace": 194,
"bbbp": 234,
"hiv": 495,
"clintox": 254,
"tox21": 267,
"sider": 982,
"muv": 84,
"iron": 211,
}
max_len = smiles_max_len_dict.get(dataset, 500)
###########################################################
# Layers Settings #
###########################################################
gnn_cls_config = {
"gnn_config": {
"embed_dim": 64,
"dropout": 0.5,
"layer_num": 5,
"readout": "mean",
"atom_names": [
"atomic_num",
"formal_charge",
"degree",
"chiral_tag",
"total_numHs",
"is_aromatic",
"hybridization",
],
"bond_names": ["bond_dir", "bond_type", "is_in_ring"],
"bond_float_names": ["bond_length"],
"bond_angle_float_names": ["bond_angle"],
},
"classifier_config": {
"layer_num": 2,
"input_dim": 64,
"hidden_dim": 128,
"output_dim": num_tasks,
"dropout_rate": 0.2,
},
}
seq_cls_config = {
"seq_config": {
"embed_dim": 32,
"hid_dim": 128,
"out_dim": 64,
"num_layer": 2,
"max_len": max_len,
},
"classifier_config": {
"layer_num": 2,
"input_dim": 64,
"hidden_dim": 64,
"output_dim": num_tasks,
"dropout_rate": 0.2,
},
}
clfu_config = {
"dim_in": 64,
"dim_hid": 128,
"mlp_config": {
"layer_num": 2,
# after the dim_hid
"input_dim": 128,
"hidden_dim": 256,
"output_dim": num_tasks,
"dropout_rate": 0.2,
},
}
###########################################################
# Trainer Settings #
###########################################################
trainer_gnn_config = {
"seed": dataset_seed,
"cuda_device": cuda_device_num,
"batch_size": 64,
"lr": 3e-4,
"epoch": 300,
"dataset": dataset,
"weight_decay": 1e-5,
"model_type": "gnn",
"early_stop_patience": 30,
"comments": "train gnn",
"save_id": 100,
}
trainer_seq_config = {
"seed": dataset_seed,
"cuda_device": cuda_device_num,
"batch_size": 64,
"lr": 4e-5, # 5e-5
"epoch": 300,
"dataset": dataset,
"weight_decay": 1e-3,
"model_type": "seq",
"early_stop_patience": 30,
"comments": "train seq",
"save_id": 100,
}
trainer_clfu_config = {
"seed": dataset_seed,
"cuda_device": cuda_device_num,
"batch_size": 32,
"lr": 1e-4,
"epoch": 1000,
"dataset": dataset,
"weight_decay": 1e-5,
"model_type": "CLFU",
"early_stop_patience": 30,
"de_novo_train_graph": False,
"de_novo_train_seq": False,
"comments": "late fusion",
"save_id": 1,
}