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

Make examples use start_client(). #2718

Merged
merged 15 commits into from
Jan 25, 2024
Prev Previous commit
Next Next commit
Merge branch 'main' into numpy-clients-no-more
  • Loading branch information
jafermarq authored Jan 23, 2024
commit 4ba07db2168e9ed753238ad896a23b0036c9603f
31 changes: 26 additions & 5 deletions examples/quickstart-pandas/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,29 @@ def fit(
)


# Start Flower client
fl.client.start_client(
server_address="127.0.0.1:8080",
client=FlowerClient().to_client(),
)
if __name__ == "__main__":
N_CLIENTS = 2

parser = argparse.ArgumentParser(description="Flower")
parser.add_argument(
"--node-id",
type=int,
choices=range(0, N_CLIENTS),
required=True,
help="Specifies the node id of artificially partitioned datasets.",
)
args = parser.parse_args()
partition_id = args.node_id

# Load the partition data
fds = FederatedDataset(dataset="hitorilabs/iris", partitioners={"train": N_CLIENTS})

dataset = fds.load_partition(partition_id, "train").with_format("pandas")[:]
# Use just the specified columns
X = dataset[column_names]

# Start Flower client
fl.client.start_numpy_client(
server_address="127.0.0.1:8080",
client=FlowerClient(X).to_client(),
)
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.