-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.py
62 lines (56 loc) · 3.56 KB
/
options.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import argparse
def args_parser():
parser = argparse.ArgumentParser()
# General Arguments
parser.add_argument('-go', "--goal", type=str, default="test",
help="The goal for this experiment")
parser.add_argument('-dev', "--device", type=str, default="cuda",
choices=["cpu", "cuda"])
parser.add_argument('-did', "--device_id", type=str, default="0")
parser.add_argument('-data', "--dataset", type=str, default="mnist")
parser.add_argument('-nb', "--num_classes", type=int, default=10)
parser.add_argument('-m', "--model", type=str, default="cnn")
parser.add_argument('-lbs', "--batch_size", type=int, default=10)
parser.add_argument('-lr', "--local_learning_rate", type=float, default=0.005,
help="Local learning rate")
parser.add_argument('-ld', "--learning_rate_decay", type=bool, default=False)
parser.add_argument('-ldg', "--learning_rate_decay_gamma", type=float, default=0.99)
parser.add_argument('-gr', "--global_rounds", type=int, default=2000)
parser.add_argument('-ls', "--local_epochs", type=int, default=1,
help="Multiple update steps in one local epoch.")
parser.add_argument('-algo', "--algorithm", type=str, default="FedAvg")
parser.add_argument('-jr', "--join_ratio", type=float, default=1.0,
help="Ratio of clients per round")
parser.add_argument('-rjr', "--random_join_ratio", type=bool, default=False,
help="Random ratio of clients per round")
parser.add_argument('-nc', "--num_clients", type=int, default=20,
help="Total number of clients")
parser.add_argument('-pv', "--prev", type=int, default=0,
help="Previous Running times")
parser.add_argument('-t', "--times", type=int, default=1,
help="Running times")
parser.add_argument('-eg', "--eval_gap", type=int, default=1,
help="Rounds gap for evaluation")
parser.add_argument('-dp', "--privacy", type=bool, default=False,
help="differential privacy")
parser.add_argument('-dps', "--dp_sigma", type=float, default=0.0)
parser.add_argument('-sfn', "--save_folder_name", type=str, default='items')
parser.add_argument('-ab', "--auto_break", type=bool, default=False)
parser.add_argument('-dlg', "--dlg_eval", type=bool, default=False)
parser.add_argument('-dlgg', "--dlg_gap", type=int, default=100)
parser.add_argument('-bnpc', "--batch_num_per_client", type=int, default=2)
parser.add_argument('-nnc', "--num_new_clients", type=int, default=0)
parser.add_argument('-ften', "--fine_tuning_epoch_new", type=int, default=0)
# Practical Arguments
parser.add_argument('-cdr', "--client_drop_rate", type=float, default=0.0,
help="Rate for clients that train but drop out")
parser.add_argument('-tsr', "--train_slow_rate", type=float, default=0.0,
help="The rate for slow clients when training locally")
parser.add_argument('-ssr', "--send_slow_rate", type=float, default=0.0,
help="The rate for slow clients when sending global model")
parser.add_argument('-ts', "--time_select", type=bool, default=False,
help="Whether to group and select clients at each round according to time cost")
parser.add_argument('-tth', "--time_threthold", type=float, default=10000,
help="The threthold for droping slow clients")
args = parser.parse_args()
return args