main.py

import torch  
import utility
import data
import model
import loss
from option import args
from trainer import Trainer

# To make sure that each time the-generade-random-number is fixed
torch.manual_seed(args.seed)

#print ("1-1-checkpoint")

# Open the module utility
checkpoint = utility.checkpoint(args)
#print ("1-2-checkpoint")

# 
if checkpoint.ok:
    print ("1-3-checkpoint")
    loader = data.Data(args,None)
    #print ("1-4-checkpoint")
    model = model.Model(args, checkpoint)
    #print ("1-5-checkpoint")
    loss = loss.Loss(args, checkpoint) if not args.test_only else None
    #print ("1-6-checkpoint")
    t = Trainer(args, loader, model, loss, checkpoint)
    #print ("1-7-checkpoint")
    while not t.terminate():
        t.train()
        t.test()
        #print ("1-8a-checkpoint")
    checkpoint.done()
    print ("1-8-checkpoint")

你可能感兴趣的:(main.py)