device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') print('device: {}'.format(device)) train = Train(device) train.train_model(is_resume, epoch, file) if args.t: # testing if args.f: file = args.f else: file = config.best_model torch.cuda.empty_cache() device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') print('device: {}'.format(device)) test = Test(device) test.test_model(file) if args.e: # rouge evaluation s_file = args.sf r_file = args.rf torch.cuda.empty_cache() device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') print('device: {}'.format(device)) test = Evaluate(device) # files to be pass here final = test.evaluate_summaries(config.s_summaries) # this gives size in kbs -- have to convert in bytes usage = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * 1024 memory = get_size(usage)