Exemplo n.º 1
0
def run():

    experiments_raw = json.loads(args.hp)

    hp_dicts = [
        hp for x in experiments_raw for hp in xpm.get_all_hp_combinations(x)
    ][args.start:args.end]
    if args.reverse_order:
        hp_dicts = hp_dicts[::-1]
    experiments = [xpm.Experiment(hyperparameters=hp) for hp in hp_dicts]

    print("Running {} Experiments..\n".format(len(experiments)))
    for xp_count, experiment in enumerate(experiments):
        run_experiment(experiment, xp_count, len(experiments))
Exemplo n.º 2
0
def run():
    with open('federated_learning.json') as data_file:
        experiments_raw = json.load(data_file)[args.schedule]

    hp_dicts = [
        hp for x in experiments_raw for hp in xpm.get_all_hp_combinations(x)
    ][args.start:args.end]
    if args.reverse_order:
        hp_dicts = hp_dicts[::-1]
    experiments = [xpm.Experiment(hyperparameters=hp) for hp in hp_dicts]

    print("Running {} Experiments..\n".format(len(experiments)))
    for xp_count, experiment in enumerate(experiments):
        run_experiment(experiment, xp_count, len(experiments))
Exemplo n.º 3
0
parser.add_argument("--schedule", default="main", type=str)
parser.add_argument("--start", default=0, type=int)
parser.add_argument("--end", default=None, type=int)
parser.add_argument("--reverse_order", default=False, type=bool)

print("Torch Version: ", torch.__version__)
device = 'cuda' if torch.cuda.is_available() else 'cpu'

args = parser.parse_args()

# Load the Hyperparameters of all Experiments to be performed and set up the Experiments
with open('federated_learning.json') as data_file:
    experiments_raw = json.load(data_file)[args.schedule]

hp_dicts = [
    hp for x in experiments_raw for hp in xpm.get_all_hp_combinations(x)
][args.start:args.end]
if args.reverse_order:
    hp_dicts = hp_dicts[::-1]
experiments = [xpm.Experiment(hyperparameters=hp) for hp in hp_dicts]


def run_experiments(experiments):
    print("Running {} Experiments..\n".format(len(experiments)))
    for xp_count, xp in enumerate(experiments):
        hp = dhp.get_hp(xp.hyperparameters)
        xp.prepare(hp)
        print(xp)

        # Load the Data and split it among the Clients
        client_loaders, train_loader, test_loader, stats = data_utils.get_data_loaders(