-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
34 lines (29 loc) · 910 Bytes
/
main.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
import os
import re
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from models.enet import LightningEnet
from pytorch_lightning.callbacks.model_checkpoint import ModelCheckpoint
import pytorch_lightning as pl
from unet import LightningUNet
def main():
model = LightningUNet(n_class = 6)
os.makedirs('enet_results', exist_ok = True)
checkpoint_callback = ModelCheckpoint(
filepath = "enet_results",
verbose = True,
monitor = "val_loss",
mode = "min",
prefix = "",
)
trainer = pl.Trainer(gpus = 1,
default_save_path = 'enet_results',
max_epochs = 100,
checkpoint_callback = checkpoint_callback,
show_progres_bar = True,
)
trainer.fit(model)
if __name__ == "__main__":
main()