-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathmain.py
More file actions
26 lines (20 loc) · 680 Bytes
/
main.py
File metadata and controls
26 lines (20 loc) · 680 Bytes
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
import torch
from options import args
from models import model_factory
from dataloaders import dataloader_factory
from trainers import trainer_factory
from utils import *
def train():
export_root = setup_train(args)
train_loader, val_loader, test_loader = dataloader_factory(args)
model = model_factory(args)
trainer = trainer_factory(args, model, train_loader, val_loader, test_loader, export_root)
trainer.train()
test_model = (input('Test model with test dataset? y/[n]: ') == 'y')
if test_model:
trainer.test()
if __name__ == '__main__':
if args.mode == 'train':
train()
else:
raise ValueError('Invalid mode')