-
Notifications
You must be signed in to change notification settings - Fork 941
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fds-add-inner-dirichlet-partitioner
- Loading branch information
Showing
5 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/py/flwr/cli/new/templates/app/code/client.numpy.py.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""$project_name: A Flower / NumPy app.""" | ||
|
||
import flwr as fl | ||
import numpy as np | ||
|
||
|
||
# Flower client, adapted from Pytorch quickstart example | ||
class FlowerClient(fl.client.NumPyClient): | ||
def get_parameters(self, config): | ||
return [np.ones((1, 1))] | ||
|
||
def fit(self, parameters, config): | ||
return ([np.ones((1, 1))], 1, {}) | ||
|
||
def evaluate(self, parameters, config): | ||
return float(0.0), 1, {"accuracy": float(1.0)} | ||
|
||
|
||
def client_fn(cid: str): | ||
return FlowerClient().to_client() | ||
|
||
|
||
# ClientApp for Flower-Next | ||
app = fl.client.ClientApp(client_fn=client_fn) |
12 changes: 12 additions & 0 deletions
12
src/py/flwr/cli/new/templates/app/code/server.numpy.py.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"""$project_name: A Flower / NumPy app.""" | ||
|
||
import flwr as fl | ||
|
||
# Configure the strategy | ||
strategy = fl.server.strategy.FedAvg() | ||
|
||
# Flower ServerApp | ||
app = fl.server.ServerApp( | ||
config=fl.server.ServerConfig(num_rounds=1), | ||
strategy=strategy, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
[flower] | ||
[project] | ||
name = "$project_name" | ||
version = "1.0.0" | ||
description = "" | ||
license = "Apache-2.0" | ||
authors = ["The Flower Authors <hello@flower.ai>"] | ||
|
||
[components] | ||
[flower.components] | ||
serverapp = "$project_name.server:app" | ||
clientapp = "$project_name.client:app" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
flwr>=1.8, <2.0 | ||
numpy >= 1.21.0 |