-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
36 lines (33 loc) · 1.08 KB
/
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
35
36
"""Main module
2020.08.18
"""
import os
import torch
import random
import config
import numpy as np
from ce_loss import Trainer as ce_trainer
from restricted_model_trainer import Trainer as restricted_trainer
from intra_model_trainer import Trainer as intra_trainer
def main():
args = config.get_config()
if args.phase == 'ce':
print("Standard model will be trained")
trainer = ce_trainer(args)
trainer.training(args)
elif args.phase == 'restricted':
if not os.path.exists(
f'{args.save_path}/{args.dataset}/ce_{args.ce_epoch}_model_{args.model}.pt'
):
print("Standard model for Restricted loss model will be trained")
trainer = ce_trainer(args)
trainer.training(args)
print("Restricted loss model will be trained")
trainer = restricted_trainer(args)
trainer.training(args)
else:
print("Intra model will be trained")
trainer = intra_trainer(args)
trainer.training(args)
if __name__ == "__main__":
main()