Skip to content

Commit

Permalink
sending sample size in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilinghan committed Mar 13, 2024
1 parent 9775f88 commit 85091b9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 32 deletions.
14 changes: 3 additions & 11 deletions examples/config/server_fedasync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ server_configs:
same_init_model: True
aggregator: "FedAsyncAggregator"
aggregator_kwargs:
weights: "equal"
client_weights_mode: "equal"
num_clients: 2
staleness_fn: "polynomial"
staleness_fn_kwargs:
a: 0.5
Expand All @@ -62,13 +63,4 @@ server_configs:
comm_configs:
server_uri: localhost:50051
max_message_size: 1048576

use_ssl: False
# # SSL configurations
# use_ssl: True
# use_authenticator: True
# server_certificate_key: ../src/appfl/comm/grpc/credentials/localhost.key
# server_certificate: ../src/appfl/comm/grpc/credentials/localhost.crt
# authenticator: NaiveAuthenticator
# authenticator_args:
# auth_token: a-secret-token
use_ssl: False
13 changes: 2 additions & 11 deletions examples/config/server_fedavg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ server_configs:
same_init_model: True
aggregator: "FedAvgAggregator"
aggregator_kwargs:
weights: "equal"
client_weights_mode: "equal"
device: "cpu"
num_epochs: 2
server_validation: False
Expand All @@ -55,13 +55,4 @@ server_configs:
comm_configs:
server_uri: localhost:50051
max_message_size: 1048576

use_ssl: False
# # SSL configurations
# use_ssl: True
# use_authenticator: True
# server_certificate_key: ../src/appfl/comm/grpc/credentials/localhost.key
# server_certificate: ../src/appfl/comm/grpc/credentials/localhost.crt
# authenticator: NaiveAuthenticator
# authenticator_args:
# auth_token: a-secret-token
use_ssl: False
12 changes: 2 additions & 10 deletions examples/config/server_fedcompass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ server_configs:
a: 0.5
alpha: 0.9
gradient_based: True
client_weights_mode: "equal"
device: "cpu"
num_epochs: 2
server_validation: False
Expand All @@ -66,13 +67,4 @@ server_configs:
comm_configs:
server_uri: localhost:50051
max_message_size: 1048576

use_ssl: False
# # SSL configurations
# use_ssl: True
# use_authenticator: True
# server_certificate_key: ../src/appfl/comm/grpc/credentials/localhost.key
# server_certificate: ../src/appfl/comm/grpc/credentials/localhost.crt
# authenticator: NaiveAuthenticator
# authenticator_args:
# auth_token: a-secret-token
use_ssl: False
5 changes: 5 additions & 0 deletions examples/run_client_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
init_global_model = client_comm.get_global_model(init_model=True)
client_agent.load_parameters(init_global_model)

# Send the number of load data to the server
sample_size = client_agent.get_sample_size()
print(f"Sample size: {sample_size}")
client_comm.invoke_custom_action(action='set_sample_size', sample_size=sample_size)

for i in range(10):
client_agent.train()
local_model = client_agent.get_parameters()
Expand Down
5 changes: 5 additions & 0 deletions examples/run_client_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
init_global_model = client_comm.get_global_model(init_model=True)
client_agent.load_parameters(init_global_model)

# Send the number of load data to the server
sample_size = client_agent.get_sample_size()
print(f"Sample size: {sample_size}")
client_comm.invoke_custom_action(action='set_sample_size', sample_size=sample_size)

for i in range(10):
client_agent.train()
local_model = client_agent.get_parameters()
Expand Down

0 comments on commit 85091b9

Please sign in to comment.