示例#1
0
def main():
    """ Training
    """
    opt = Options().parse()
    data = load_data(opt)
    model = load_model(opt, data)
    model.train()
示例#2
0
def main():
    """ Training
    """
    opt = Options().parse()
    data = load_data(opt)  # 所得到的data包括train_data和test_data,用data.train_data获取训练数据,data.valid_data获取测试数据。
    model = load_model(opt, data)
    model.train()
示例#3
0
def main():
    """ Training
    """
    torch.autograd.set_detect_anomaly(True)
    wandb.init(entity="wenxun", project="tutorial")
    opt = Options().parse()
    data = load_data(opt)
    model = load_model(opt, data)
    model.train()
示例#4
0
def main():
    """ Training
    """
    opt = Options().parse()
    opt.print_freq = opt.batchsize
    seed(opt.manualseed)
    print("Seed:", str(torch.seed()))
    if opt.phase == "inference":
        opt.batchsize=1
    data = load_data(opt)
    model = load_model(opt, data)
    if opt.phase == "inference":
        model.inference()
    else:
        if opt.path_to_weights:
            model.test()
        else:
            train_start = time.time()
            model.train()
            train_time = time.time() - train_start
            print (f'Train time: {train_time} secs')
示例#5
0
def main():
    """ Training
    """
    opt = Options().parse()
    data = load_data(opt)
    load_then_export_model(opt, data)