Skip to content

nclabteam/FL-Demo-With-Flower

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This repo is a simple example of how Federated Learning can be implemented using Flower.

In this demo we are going to perform federated learning with flower using a server and two clients.

Setting Up the Environment:

This code is developed and tested on an ubuntu machine with python 3.8 installed and venv for virtual environment management.

  1. Clone the repository by pasting the below command in the terminal.

    git clone https://github.com/nclabteam/FL-Demo-With-Flower.git
  2. After the repository is cloned, open the cloned repository in terminal.

    cd FL-Demo-With-Flower/
  3. Ensure pip is installed if not install using

    sudo apt install python3-pip
  4. We are using venv package to create virtual environent you can use any virtual environment libary to proceed. Run the below command in terminal to install venv.

    sudo apt install python3.8-venv
  5. Use python venv to create a virtual environment for our project

    python3 -m venv venv-flwr-demo

    Where "venv-flwr-demo" is the name of the virtual environment that we want to create. We can choose any name that we like instead of venv-flwr-demo. After this step a new directory (venv-flwr-demo) will be created.

  6. For using virtual environment we need to activate the environment first.

    source venv-flwr-demo/bin/activate
  7. Now we can install the project requirements or dependencies inside virtual environment using terminal as:

    pip3 install -r requirements.txt
  8. Open two more terminal windows in the same directory and again activate the virtual env for those terminals also as shown in step 6.

  9. In one terminal run the server.py file

    python3 server.py
  10. Run client1.py in second terminal

    python3 client1.py
  11. Run client2.py in third terminal

    python3 client2.py

About

Demo to show how Federated Learning Works with Flower.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages