Skip to content

Commit

Permalink
added defkt
Browse files Browse the repository at this point in the history
  • Loading branch information
jyuan24 committed Aug 14, 2024
1 parent 1fbdc16 commit e7cbdca
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 5 deletions.
21 changes: 20 additions & 1 deletion src/configs/algo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
50 changes: 46 additions & 4 deletions src/configs/sys_config.py
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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
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

0 comments on commit e7cbdca

Please sign in to comment.