Skip to content

Commit

Permalink
Update flwr server
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanTingHsieh committed Oct 7, 2024
1 parent 9405342 commit 50b3b17
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions examples/hello-world/hello-flower/flwr-pt-tb/flwr_pt_tb/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from typing import List, Tuple

from flwr.common import Metrics, ndarrays_to_parameters
from flwr.server import ServerApp, ServerConfig
from flwr.server import ServerApp, ServerConfig, ServerAppComponents
from flwr.common import Context
from flwr.server.strategy import FedAvg

from .task import Net, get_weights
Expand Down Expand Up @@ -53,13 +54,16 @@ def weighted_average(metrics: List[Tuple[int, Metrics]]) -> Metrics:
initial_parameters=parameters,
)


# Define config
config = ServerConfig(num_rounds=3)


# Flower ServerApp
app = ServerApp(
config=config,
strategy=strategy,
)
def server_fn(context: Context):
return ServerAppComponents(
strategy=strategy,
config=config,
)


app = ServerApp(server_fn=server_fn)

0 comments on commit 50b3b17

Please sign in to comment.