diff --git a/src/configs/algo_config.py b/src/configs/algo_config.py index cf686fd..d20dbcb 100644 --- a/src/configs/algo_config.py +++ b/src/configs/algo_config.py @@ -131,4 +131,23 @@ "exp_keys": ["similarity_metric", "selection_strategy", "consensus"] } -current_config = fedweight +defkt = { + "algo": "defkt", + "exp_id": "defkt", + "central_client": 1, + "mask_last_layer": False, + "fine_tune_last_layer": False, + "epochs_per_round": 5, + "rounds": 210, + "epochs": 210, + "model": "resnet10", + "model_lr": 1e-4, + "batch_size": 16, + "num_teachers": 1, + # params for model + "position": 0, + "inp_shape": [128, 3, 32, 32], + "exp_keys": [], +} + +current_config = defkt diff --git a/src/configs/sys_config.py b/src/configs/sys_config.py index 94cc374..42cc949 100644 --- a/src/configs/sys_config.py +++ b/src/configs/sys_config.py @@ -1,7 +1,32 @@ # System Configuration # TODO: Set up multiple non-iid configurations here. The goal of a separate system config # is to simulate different real-world scenarios without changing the algorithm configuration. -from utils.config_utils import get_sliding_window_support +from utils.config_utils import get_sliding_window_support, get_device_ids + +def get_domain_support(num_clients, base, domains): + assert num_clients % len(domains) == 0 + + clients_per_domain = num_clients // len(domains) + support = {} + support["0"] = f"{base}_{domains[0]}" + for i in range(1, num_clients + 1): + support[str(i)] = f"{base}_{domains[(i-1) // clients_per_domain]}" + return support + +DOMAINNET_DMN = ["real", "sketch", "clipart"] + +def get_domainnet_support(num_clients, domains=DOMAINNET_DMN): + return get_domain_support(num_clients, "domainnet", domains) + +domainnet_base_dir = "/u/abhi24/matlaberp2/p2p/imgs/domainnet/" +domainnet_dpath = { + "domainnet_real": domainnet_base_dir, + "domainnet_sketch": domainnet_base_dir, + "domainnet_clipart": domainnet_base_dir, + "domainnet_infograph": domainnet_base_dir, + "domainnet_quickdraw": domainnet_base_dir, + "domainnet_painting": domainnet_base_dir, +} system_config = { "num_users": 3, @@ -19,10 +44,27 @@ "device_ids": {"node_0": [1], "node_1": [1],"node_2": [1], "node_3": [1]}, "samples_per_user": 500, #TODO: To model scenarios where different users have different number of samples # we need to make this a dictionary with user_id as key and number of samples as value - "train_label_distribution": "non_iid", # Either "iid", "non_iid" "support" - "test_label_distribution": "non_iid", # Either "iid", "non_iid" "support" + "train_label_distribution": "iid", # Either "iid", "non_iid" "support" + "test_label_distribution": "iid", # Either "iid", "non_iid" "support" "test_samples_per_user": 200, # Only for non_iid test distribution "folder_deletion_signal_path":"./expt_dump/folder_deletion.signal" } -current_config = system_config \ No newline at end of file +non_iid_sys_config = { + "seed": 1, + "num_users": 12, + "experiment_path": "./experiments/", + "dset": "cifar10", + "dump_dir": "./expt_dump/", + "dpath": "./datasets/imgs/cifar10/", + "load_existing": False, + "device_ids": get_device_ids( + num_users=12, num_client_per_gpu=7, available_gpus=[1, 2] + ), + "train_label_distribution": "non_iid", # Either "iid", "non_iid" "support", + "test_label_distribution": "non_iid", # Either "iid" "support", + "samples_per_user": 32, + "test_samples_per_user": 32, +} + +current_config = non_iid_sys_config \ No newline at end of file