-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
186 lines (153 loc) · 5.64 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
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
184
185
186
import os
import numpy as np
class Config_MAE_fMRI: # back compatibility
pass
class Config_MBM_finetune: # back compatibility
pass
class Config_MBM_EEG(Config_MAE_fMRI):
# configs for fmri_pretrain.py
def __init__(self):
# --------------------------------------------
# MAE for fMRI
# Training Parameters
self.lr = 2.5e-4
self.min_lr = 0.
self.weight_decay = 0.05
self.num_epoch = 500
self.warmup_epochs = 40
self.batch_size = 64
self.clip_grad = 0.8
# Model Parameters
self.mask_ratio = 0.75
self.patch_size = 4 # 1
self.embed_dim = 1024 #256 # has to be a multiple of num_heads
self.decoder_embed_dim = 512 #128
self.depth = 24
self.num_heads = 16
self.decoder_num_heads = 16
self.mlp_ratio = 1.0
# Project setting
self.root_path = '../dreamdiffusion/'
self.output_path = '../dreamdiffusion/exps/'
self.seed = 2022
self.roi = 'VC'
self.aug_times = 1
self.num_sub_limit = None
self.include_hcp = True
self.include_kam = True
self.accum_iter = 1
self.use_nature_img_loss = False
self.img_recon_weight = 0.5
self.focus_range = None # [0, 1500] # None to disable it
self.focus_rate = 0.6
# distributed training
self.local_rank = 0
class Config_EEG_finetune(Config_MBM_finetune):
def __init__(self):
# Project setting
self.root_path = '../dreamdiffusion/'
# self.root_path = '.'
self.output_path = '../dreamdiffusion/exps/'
self.eeg_signals_path = os.path.join(self.root_path, 'datasets/eeg_5_95_std.pth')
self.splits_path = os.path.join(self.root_path, 'datasets/block_splits_by_image_all.pth')
self.dataset = 'EEG'
self.pretrain_mbm_path = '../dreamdiffusion/pretrains/eeg_pretrain/checkpoint.pth'
self.include_nonavg_test = True
# Training Parameters
self.lr = 5.3e-5
self.weight_decay = 0.05
self.num_epoch = 15
self.batch_size = 16 if self.dataset == 'GOD' else 4
self.mask_ratio = 0.75
self.accum_iter = 1
self.clip_grad = 0.8
self.warmup_epochs = 2
self.min_lr = 0.
self.use_nature_img_loss = False
self.img_recon_weight = 0.5
self.focus_range = None # [0, 1500] # None to disable it
self.focus_rate = 0.6
# distributed training
self.local_rank = 0
class Config_Generative_Model:
def __init__(self):
# project parameters
self.seed = 2022
self.root_path = '../dreamdiffusion/'
self.output_path = '../dreamdiffusion/exps/'
self.eeg_signals_path = os.path.join(self.root_path, 'datasets/eeg_5_95_std.pth')
self.splits_path = os.path.join(self.root_path, 'datasets/block_splits_by_image_single.pth')
# self.splits_path = os.path.join(self.root_path, 'datasets/block_splits_by_image_all.pth')
self.roi = 'VC'
self.patch_size = 4 # 16
self.embed_dim = 1024
self.depth = 24
self.num_heads = 16
self.mlp_ratio = 1.0
self.pretrain_gm_path = os.path.join(self.root_path, 'pretrains')
self.dataset = 'EEG'
self.pretrain_mbm_path = None
# self.img_size = 256
self.img_size = 512
np.random.seed(self.seed)
# finetune parameters
self.batch_size = 5 if self.dataset == 'GOD' else 25
self.lr = 5.3e-5
self.num_epoch = 500
self.precision = 32
self.accumulate_grad = 1
self.crop_ratio = 0.2
self.global_pool = False
self.use_time_cond = True
self.clip_tune = True #False
self.cls_tune = False
self.subject = 4
self.eval_avg = True
# diffusion sampling parameters
self.num_samples = 5
self.ddim_steps = 250
# self.ddim_steps = 1
self.HW = None
# resume check util
self.model_meta = None
self.checkpoint_path = None
class Config_Cls_Model:
def __init__(self):
# project parameters
self.seed = 2022
self.root_path = '../dreamdiffusion/'
self.output_path = '../dreamdiffusion/exps/'
# self.eeg_signals_path = os.path.join(self.root_path, 'datasets/eeg_5_95_std.pth')
self.eeg_signals_path = os.path.join(self.root_path, 'datasets/eeg_14_70_std.pth')
# self.splits_path = os.path.join(self.root_path, 'datasets/block_splits_by_image_single.pth')
self.splits_path = os.path.join(self.root_path, 'datasets/block_splits_by_image_all.pth')
self.roi = 'VC'
self.patch_size = 4 # 16
self.embed_dim = 1024
self.depth = 24
self.num_heads = 16
self.mlp_ratio = 1.0
self.pretrain_gm_path = os.path.join(self.root_path, 'pretrains')
self.dataset = 'EEG'
self.pretrain_mbm_path = None
self.img_size = 256
np.random.seed(self.seed)
# finetune parameters
self.batch_size = 5 if self.dataset == 'GOD' else 25
self.lr = 5.3e-5
self.num_epoch = 50
self.precision = 32
self.accumulate_grad = 1
self.crop_ratio = 0.15
self.global_pool = False
self.use_time_cond = False
self.clip_tune = False
self.subject = 4
self.eval_avg = True
# diffusion sampling parameters
self.num_samples = 5
self.ddim_steps = 250
self.HW = None
# resume check util
self.model_meta = None
self.checkpoint_path = None