示例#1
0
    U.timeCheck('s', stime)
    saved_examples = U.getSavedExamples('BILINEAR0016pre-3MTEST_testdata.p')
    DataManager = DS.NewsDataset(saved_examples, Vocab, True)
    U.timeCheck('e', stime)

if True:
    # Define Model
    print('before calling model allocated (dictionary): ', end=' ')
    print(torch.cuda.memory_allocated(1))
    print("Calling Model .... ", end='')
    U.timeCheck('s', stime)
    if 'SCORE' in Args.args.model_name:
        NET = Model.ScoringNetwork(Vocab).to(torch.device(Args.args.device))
        print('ScoreNet Created')
    elif 'BILINEAR' in Args.args.model_name:
        NET = Model.BiLinearNetwork(Vocab).to(torch.device(Args.args.device))
        print('BiLinearNet Created')
    print("Done !!!", end='    ')
    U.timeCheck('e', stime)

if True:
    # Training Model
    print("Training Model .... ")
    U.timeCheck('s', stime)
    print('memory allocated (dictionary): ', end=' ')
    print(torch.cuda.memory_allocated(1))
    trainloader = DataManager.get_trainloader(DataManager, 'train',
                                              Args.args.batch_size)
    referenced_id['trained'] = Train.Train(trainloader, NET)
    print("Done Training !!!", end='    ')
    U.timeCheck('e', stime)