def main(): args = get_train_args() utils.set_seed(args.seed) device = utils.get_device(args) # Initialize Dataset for each tasks assert args.dataset in ["splitMNIST", "permutedMNIST", 'fashionMNIST'] if args.dataset == "splitMNIST" or args.dataset == 'fashionMNIST': labels_list = [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]] elif args.dataset == 'permutedMNIST': labels_list = [list(range(10))] * 5 # Run VCL task_final_accs, all_accs = vcl.run_vcl(args, device, labels_list) # Plots config_str = '_{}_coreset_{}'.format(args.dataset, args.coreset_size) utils.plot_small(task_final_accs, config_str) utils.plot_all(all_accs, config_str) avg_acc = np.mean(all_accs[-1]) print ("Final Average Accuracy: {}".format(avg_acc))
return next_x_train, next_y_train, next_x_test, next_y_test hidden_size = [100, 100] batch_size = 256 no_epochs = 100 single_head = True num_tasks = 5 # Run vanilla VCL tf.set_random_seed(12) np.random.seed(1) coreset_size = 0 data_gen = PermutedMnistGenerator(num_tasks) vcl_result = vcl.run_vcl(hidden_size, no_epochs, data_gen, coreset.rand_from_batch, coreset_size, batch_size, single_head) print vcl_result # Run random coreset VCL tf.reset_default_graph() tf.set_random_seed(12) np.random.seed(1) coreset_size = 200 data_gen = PermutedMnistGenerator(num_tasks) rand_vcl_result = vcl.run_vcl(hidden_size, no_epochs, data_gen, coreset.rand_from_batch, coreset_size, batch_size, single_head) print rand_vcl_result # Run k-center coreset VCL tf.reset_default_graph()
num_tasks = args.tasknum train_info = {} train_info['date'] = args.date train_info['experiment'] = args.experiment train_info['trial'] = args.trial train_info['batch'] = args.batch train_info['tasknum'] = args.tasknum # Run vanilla VCL tf.set_random_seed(11 + args.trial) np.random.seed(args.trial) train_info['coreset_method']='none' coreset_size = 0 data_gen = PermutedMnistGenerator(num_tasks) vcl_result = vcl.run_vcl(hidden_size, no_epochs, data_gen, coreset.rand_from_batch, coreset_size, batch_size, single_head, train_info) print (vcl_result) """ # Run random coreset VCL tf.reset_default_graph() tf.set_random_seed(11 + args.trial) np.random.seed(args.trial) train_info['coreset_method']='random' coreset_size = 200 data_gen = PermutedMnistGenerator(num_tasks) rand_vcl_result = vcl.run_vcl(hidden_size, no_epochs, data_gen, coreset.rand_from_batch, coreset_size, batch_size, single_head, train_info) print (rand_vcl_result)