Flower App (PyTorch) π§ͺ#
π§ͺ = This example covers experimental features that might change in future versions of Flower Please consult the regular PyTorch code examples (quickstart, advanced) to learn how to use Flower with PyTorch.
The following steps describe how to start a long-running Flower server (SuperLink) and then run a Flower App (consisting of a ClientApp
and a ServerApp
).
Preconditions#
Letβs assume the following project structure:
$ tree .
.
βββ client.py # <-- contains `ClientApp`
βββ server.py # <-- contains `ServerApp`
βββ server_workflow.py # <-- contains `ServerApp` with workflow
βββ server_custom.py # <-- contains `ServerApp` with custom main function
βββ task.py # <-- task-specific code (model, data)
βββ requirements.txt # <-- dependencies
Install dependencies#
pip install -r requirements.txt
Run a simulation#
flower-simulation --server-app server:app --client-app client:app --num-supernodes 2
Run a deployment#
Start the long-running Flower server (SuperLink)#
flower-superlink --insecure
Start the long-running Flower client (SuperNode)#
In a new terminal window, start the first long-running Flower client:
flower-client-app client:app --insecure
In yet another new terminal window, start the second long-running Flower client:
flower-client-app client:app --insecure
Run the Flower App#
With both the long-running server (SuperLink) and two clients (SuperNode) up and running, we can now run the actual Flower App:
flower-server-app server:app --insecure
Or, to try the workflow example, run:
flower-server-app server_workflow:app --insecure
Or, to try the custom server function example, run:
flower-server-app server_custom:app --insecure