From 20787abdfdad7550932d1933fdbc16745c20b627 Mon Sep 17 00:00:00 2001 From: leahcimali <michaelbenalipro@gmail.com> Date: Sat, 28 Sep 2024 23:44:11 +0200 Subject: [PATCH] Added run_exp.py Added run_exp.py to be able to run all exp from exp_configs.csv in python. --- run_exp.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 run_exp.py diff --git a/run_exp.py b/run_exp.py new file mode 100644 index 0000000..2b13321 --- /dev/null +++ b/run_exp.py @@ -0,0 +1,33 @@ +import csv +import subprocess + +# Path to your CSV file +csv_file = "exp_configs.csv" + +# Read the second line from the CSV file +with open(csv_file, newline='') as csvfile: + reader = csv.reader(csvfile) + + # Skip the header (if any) and the first row + next(reader) # Skipping the header + row = next(reader) # Reading the second row + + # Assigning CSV values to variables + exp_type, dataset, heterogeneity_type, num_clients, num_samples_by_label, num_clusters, centralized_epochs, federated_rounds, seed = row + + # Building the command + command = [ + "python", "driver.py", + "--exp_type", exp_type, + "--dataset", dataset, + "--heterogeneity_type", heterogeneity_type, + "--num_clients", num_clients, + "--num_samples_by_label", num_samples_by_label, + "--num_clusters", num_clusters, + "--centralized_epochs", centralized_epochs, + "--federated_rounds", federated_rounds, + "--seed", seed + ] + + # Run the command + subprocess.run(command) -- GitLab