Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorvaladi committed Oct 8, 2024
1 parent ed468cf commit 3b5a144
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/server-functions/server_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ def __init__(self) -> None:
# Skip any function to use the default FEDn implementation for the function.

# Called first in the beggining of a round to select clients.
def client_selection(self, client_ids: list[str]) -> list:
def client_selection(self, client_ids: List[str]) -> List:
# Pick 10 random clients
client_ids = random.sample(client_ids, min(len(client_ids), 10)) # noqa: F405
return client_ids

# Called secondly before sending the global model.
def client_config(self, global_model: list[np.ndarray]) -> dict:
def client_config(self, global_model: List[np.ndarray]) -> dict:
# Decrease learning rate every 10 rounds
if self.round % 10 == 0:
self.lr = self.lr * 0.1
Expand Down
4 changes: 2 additions & 2 deletions fedn/network/combiner/hooks/serverfunctionsbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def aggregate(self, previous_global: List[np.ndarray], client_updates: Dict[str,
"""
pass

def client_config(self, global_model: list[np.ndarray]) -> dict:
def client_config(self, global_model: List[np.ndarray]) -> Dict:
"""Returns metadata related to the model, which gets distributed to the clients.
The dictionary may only contain primitive types.
Expand All @@ -54,7 +54,7 @@ def client_config(self, global_model: list[np.ndarray]) -> dict:
"""
pass

def client_selection(self, client_ids: list[str]) -> list:
def client_selection(self, client_ids: List[str]) -> List:
"""Returns a list of client_id's of which clients to be used for the next training request.
Args:
Expand Down

0 comments on commit 3b5a144

Please sign in to comment.