Skip to content

Latest commit

 

History

History
61 lines (38 loc) · 2.13 KB

README.md

File metadata and controls

61 lines (38 loc) · 2.13 KB

Federated Learning with Flower

For the Example Participant, we use the Flower framework. We follow the tutorials from the docs, to setup a federated learning server, and client. In our scenario, each participant will act as both a client and server.

This will run a gRPC server for federated learning, and we also make use of a local Flask server to handle our implementation specific needs (such as a way for the peer to evaluate models).

We also make use of the Fabric SDK here to submit models to the ledger. We use the Node.js Fabric SDK here since the Python SDK is unsupported for newer releases of Fabric (2.2). To understand how the wallet is created, and the applications communicates with the network, see the application tutorial.

How to Run

Federated Learning Service

First make sure you have the required version of python installed (^3.9), and install Poetry

pip install poetry --user

Next we'll install the required dependencies for this project

poetry install

Since PyTorch is dependent on system, please install a version of PyTorch (if no supported GPU, make sure to install CPU). We'll also install Opacus, for differential privacy.

e.g. for Linux with CUDA 10.2:

pip3 install torch torchvision torchaudio opacus

If a requirements.txt file is needed, you can generate it with:

pip list --not-required --format freeze > requirements.txt

Finally you can start the servers by running, e.g.

python manager.py -p 8 -s 8 --num-threads=1

Fabric SDK Service

This service uses an express API to allow the client to interface with the blockchain network using the Fabric SDK.

To run this, first install the dependencies

npm install

Then you can run it using

npm run start

Note: this will be started automatically with the manager