"icp/tests/python/event_plane/test_publish_subscribe.py" did not exist on "a48d932e1a43043b6af2bfa404d80fd8b16514ce"
config.py 6.49 KB
Newer Older
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import copy
import ml_collections as mlc


def model_config(name):
    c = copy.deepcopy(config)
    if(name == "model_3"):
        c.model.template.enabled = False
    elif(name == "model_4"):
        c.model.template.enabled = False
    elif(name == "model_5"):
        c.model.template.enabled = False
    
    return c
        

c_z = mlc.FieldReference(128)
c_m = mlc.FieldReference(256)
c_t = mlc.FieldReference(64)
c_e = mlc.FieldReference(64)
c_s = mlc.FieldReference(384)
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
22
23
blocks_per_ckpt = mlc.FieldReference(1)
chunk_size = mlc.FieldReference(4)#1280)
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
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
aux_distogram_bins = mlc.FieldReference(64)

config = mlc.ConfigDict({
    "model": {
        "c_z": c_z,
        "c_m": c_m,
        "c_t": c_t,
        "c_e": c_e,
        "c_s": c_s,
        "no_cycles": 4,
        "_mask_trans": False,
        "input_embedder": {
            "tf_dim": 22,
            "msa_dim": 49,
            "c_z": c_z,
            "c_m": c_m,
            "relpos_k": 32,
        },
        "recycling_embedder": {
            "c_z": c_z,
            "c_m": c_m, 
            "min_bin": 3.25,
            "max_bin": 20.75,
            "no_bins": 15,
            "inf": 1e8,
        },
        "template": {
            "distogram": {
                "min_bin": 3.25,
                "max_bin": 50.75,
                "no_bins": 39,
            },
            "template_angle_embedder": {
                # DISCREPANCY: c_in is supposed to be 51.
                "c_in": 57,
                "c_out": c_m,
            },
            "template_pair_embedder": {
                "c_in": 88,
                "c_out": c_t,
            },
            "template_pair_stack": {
                "c_t": c_t, 
                # DISCREPANCY: c_hidden_tri_att here is given in the supplement
                # as 64. In the code, it's 16.
                "c_hidden_tri_att": 16, 
                "c_hidden_tri_mul": 64,
                "no_blocks": 2, 
                "no_heads": 4, 
                "pair_transition_n": 2, 
                "dropout_rate": 0.25,
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
75
                "blocks_per_ckpt": blocks_per_ckpt,
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
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
                "chunk_size": chunk_size,
            },
            "template_pointwise_attention": {
                "c_t": c_t, 
                "c_z": c_z, 
                # DISCREPANCY: c_hidden here is given in the supplement as 64.
                # It's actually 16.
                "c_hidden": 16, 
                "no_heads": 4,
                "chunk_size": chunk_size,
            },
            "eps": 1e-6,
            "enabled": True,
            "embed_angles": True,
        },
        "extra_msa": {
            "extra_msa_embedder": {
                "c_in": 25,
                "c_out": c_e,
            },
            "extra_msa_stack": {
                "c_m": c_e,
                "c_z": c_z,
                "c_hidden_msa_att": 8,
                "c_hidden_opm": 32,
                "c_hidden_mul": 128,
                "c_hidden_pair_att": 32,
                "no_heads_msa": 8,
                "no_heads_pair": 4,
                "no_blocks": 4,
                "transition_n": 4,
                "msa_dropout": 0.15,
                "pair_dropout": 0.25,
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
109
                "blocks_per_ckpt": blocks_per_ckpt,
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
                "chunk_size": chunk_size,
                "inf": 1e9,
                "eps": 1e-10,
            },
            "enabled": True,
        },
        "evoformer_stack": {
            "c_m": c_m,
            "c_z": c_z,
            "c_hidden_msa_att": 32,
            "c_hidden_opm": 32,
            "c_hidden_mul": 128,
            "c_hidden_pair_att": 32,
            "c_s": c_s,
            "no_heads_msa": 8,
            "no_heads_pair": 4,
            "no_blocks": 48,
            "transition_n": 4,
            "msa_dropout": 0.15,
            "pair_dropout": 0.25,
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
130
            "blocks_per_ckpt": blocks_per_ckpt,
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
            "chunk_size": chunk_size,
            "inf": 1e9,
            "eps": 1e-10,
        },
        "structure_module": {
            "c_s": c_s, 
            "c_z": c_z,
            "c_ipa": 16,
            "c_resnet": 128,
            "no_heads_ipa": 12,
            "no_qk_points": 4,
            "no_v_points": 8,
            "dropout_rate": 0.1,
            "no_blocks": 8,
            "no_transition_layers": 1,
            "no_resnet_blocks": 2,
            "no_angles": 7,
            "trans_scale_factor": 10,
            "epsilon": 1e-12,
            "inf": 1e5,
        },
        "heads": {
            "lddt": {
                "no_bins": 50,
                "c_in": c_s,
                "c_hidden": 128,
            },
            "distogram": {
                "c_z": c_z,
                "no_bins": aux_distogram_bins,
            },
            "tm_score": {
                "c_z": c_z,
                "no_bins": aux_distogram_bins,
                "enabled": False,
            },
            "masked_msa": {
                "c_m": c_m,
                "c_out": 23,
            },
            "experimentally_resolved": {
                "c_s": c_s,
                "c_out": 37,
            },
        },
    },
    "relax": {
        "max_iterations": 0, # no max
        "tolerance": 2.39,
        "stiffness": 10.0,
        "max_outer_iterations": 20,
        "exclude_residues": [],
    },
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
    "loss": {
        "distogram": {
            "min_bin": 2.3125, 
            "max_bin": 21.6875, 
            "no_bins": 64, 
            "eps": 1e-6,
            "weight": 0.3, 
        },
        "experimentally_resolved": {
            "eps": 1e-8,
            "min_resolution": 0.1,
            "max_resolution": 3.0,
            "weight": 0.,
        },
        "fape": {
            "backbone": { 
                "clamp_distance": 10.,
                "loss_unit_distance": 10.,
                "weight": 0.5,
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
203
            },
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
204
205
206
207
            "sidechain": {
                "clamp_distance": 10.,
                "length_scale": 10.,
                "weight": 0.5,
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
208
            },
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
209
210
211
212
213
214
            "weight": 1.0,
        },
        "lddt": {
            "min_resolution": 0.1,
            "max_resolution": 3.0,
            "cutoff": 15.,
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
215
            "no_bins": 50,
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
216
217
218
219
220
221
222
223
224
225
226
227
228
229
            "eps": 1e-10,
            "weight": 0.01,
        },
        "masked_msa": {
            "eps": 1e-8,
            "weight": 2.0,
        },
        "supervised_chi": {
            "chi_weight": 0.5,
            "angle_norm_weight": 0.01,
            "eps": 1e-6,
            "weight": 1.0,
        },
        "violation": {
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
230
231
            "violation_tolerance_factor": 12.0,
            "clash_overlap_tolerance": 1.5,
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
232
233
234
235
            "eps": 1e-6,
            "weight": 0.,
        },
    },
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
236
})