-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_server.py
37 lines (32 loc) · 1.44 KB
/
run_server.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
"""
Starts aggregation server
"""
import argparse
from hyperaggregate.server.privacy_preserving_server import SchedulingServer
from hyperaggregate.aggregation_profiles.impl.torch_additive_sharing_model_profile import \
AverageTorchAdditiveSharingModelProfile
def parse_args():
"""Get command line arguments"""
parser = argparse.ArgumentParser(description='DeAI privacy preserving server')
parser.add_argument('--port', default='5555', metavar='N',
help='input server port number (default: 5555)')
parser.add_argument('--target-size', default=6, type=int,
help='Total number of clients per aggregation (default: 6)')
parser.add_argument('--group-size', default=3, type=int,
help='Size of group (default: 3)')
parser.add_argument('--num-actors', default=2, type=int,
help='Number of actors per group (default: 2)')
args = parser.parse_args()
return args
def main(args):
# Creates aggregation logic server by the server to client
DIGITS_TO_KEEP = 6
agg_profile = AverageTorchAdditiveSharingModelProfile(DIGITS_TO_KEEP)
# Creates and start the server
server = SchedulingServer(
args.port, target_size=args.target_size, group_size=args.group_size,
num_actors=args.num_actors, aggregation_profile=agg_profile,
debug_mode=False)
server.start()
if __name__ == "__main__":
main(parse_args())