Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not loading config in flwr run #3142

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/py/flwr/cli/new/templates/app/code/client.pytorch.py.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""$project_name: A Flower / PyTorch app."""

from flwr.client import NumPyClient, ClientApp
from flwr.cli.flower_toml import load_and_validate_with_defaults

from $project_name.task import (
Net,
Expand Down Expand Up @@ -32,17 +31,10 @@ class FlowerClient(NumPyClient):
return loss, len(self.valloader.dataset), {"accuracy": accuracy}


# Load config
cfg, *_ = load_and_validate_with_defaults()

def client_fn(cid: str):
# Load model and data
net = Net().to(DEVICE)
engine = cfg["flower"]["engine"]
num_partitions = 2
if "simulation" in engine:
num_partitions = engine["simulation"]["supernode"]["num"]
trainloader, valloader = load_data(int(cid), num_partitions)
trainloader, valloader = load_data(partition_id=int(cid), num_partitions=2)

# Return Client instance
return FlowerClient(net, trainloader, valloader).to_client()
Expand Down