forked from pinellolab/DNA-Diffusion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
train.py
54 lines (45 loc) · 1.39 KB
/
train.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
from accelerate import Accelerator
from dnadiffusion.data.dataloader import load_data
from dnadiffusion.models.diffusion import Diffusion
from dnadiffusion.models.unet import UNet
from dnadiffusion.utils.train_util import TrainLoop
def train():
accelerator = Accelerator(split_batches=True, log_with=["wandb"], mixed_precision="bf16")
data = load_data(
data_path="src/dnadiffusion/data/K562_hESCT0_HepG2_GM12878_12k_sequences_per_group.txt",
saved_data_path="src/dnadiffusion/data/encode_data.pkl",
subset_list=[
"GM12878_ENCLB441ZZZ",
"hESCT0_ENCLB449ZZZ",
"K562_ENCLB843GMH",
"HepG2_ENCLB029COU",
],
limit_total_sequences=0,
num_sampling_to_compare_cells=1000,
load_saved_data=True,
)
unet = UNet(
dim=200,
channels=1,
dim_mults=(1, 2, 4),
resnet_block_groups=4,
)
diffusion = Diffusion(
unet,
timesteps=50,
)
TrainLoop(
data=data,
model=diffusion,
accelerator=accelerator,
epochs=10000,
log_step_show=50,
sample_epoch=500,
save_epoch=500,
model_name="model_48k_sequences_per_group_K562_hESCT0_HepG2_GM12878_12k",
image_size=200,
num_sampling_to_compare_cells=1000,
batch_size=960,
).train_loop()
if __name__ == "__main__":
train()