Skip to content

Commit

Permalink
more bkg
Browse files Browse the repository at this point in the history
  • Loading branch information
jafermarq committed Oct 18, 2024
1 parent 7816316 commit d80f942
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 11 additions & 1 deletion examples/flower-authentication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ At this point your server-side is idling. First, let's connect two `SuperNodes`,
## Start the long-running Flower client-side (SuperNode)

> \[!NOTE\]
> Typically each `SuperNode` runs in a different entity/organization which has access to a dataset. In this example we are going to artificially create N dataset splits and saved them into a new directory called `datasets/`. Then, each `SuperNode` will be pointed to the dataset it should load. We provide a simple python script that does the download, partitione and saving of CIFAR-10.
> Typically each `SuperNode` runs in a different entity/organization which has access to a dataset. In this example we are going to artificially create N dataset splits and saved them into a new directory called `datasets/`. Then, each `SuperNode` will be pointed to the dataset it should load via the `--node-config` argument. We provide a simple Python script that does the download, partitione and saving of CIFAR-10.
```bash
python prepare_dataset.py
Expand Down Expand Up @@ -131,6 +131,16 @@ flower-supernode \
If you generated more than 2 client credentials, you can add more clients by opening new terminal windows and running the command
above. Don't forget to specify the correct client private and public keys for each client instance you created.

> \[!TIP\]
> Note the `--node-config` passed when spawning the `SuperNode` is accessible to the `ClientApp` via the context. In this example, the `client_fn()` uses it to load the dataset and then proceed with the training of the model.
```
def client_fn(context: Context):
# retrieve the passed `--node-config`
dataset_path = context.node_config["dataset-path"]
# then load the dataset
```

## Run the Flower App

With both the long-running server-side (SuperLink+SuperExec) and two SuperNodes up and running, we can now start run. Note that the command below points to a federation named `my-federation`. Its entry point is defined in the `pyproject.toml`.
Expand Down
3 changes: 2 additions & 1 deletion examples/flower-authentication/authexample/client_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def evaluate(self, parameters, config):
def client_fn(context: Context):
"""Construct a Client that will be run in a ClientApp."""

# Read the node_config to fetch data partition associated to this node
# Read the node_config to get the path to the dataset the SuperNode running
# this ClientApp has access to
dataset_path = context.node_config["dataset-path"]

# Read run_config to fetch hyperparameters relevant to this run
Expand Down

0 comments on commit d80f942

Please sign in to comment.