This repository contains the backend of the web solution developed to facilitate federated learning which can be orchestrated using a web front end.Both client and server code can be found here
Code for client and server is provided in their respective folders.
- pytorch 2.0 or latest
- websockets (pip install websockets)
- torchvision
- bson (pip install bson)
Download Server code and run wbsocket_server.py.
The data to be tested against for calculating test accuracy during training should be stored in a subfolder in ./data folder.
- pytorch 2.0 or latest
- websockets (pip install websockets)
- torchvision
run python client_service.py 5000 (or any number for port) on the client device
The data to train the model should be stored in a subfolder in ./data folder.
This section of the code is for managing a separate flask service for storing and downloading the trained model which will help in comparing the trained model on the front-end(user interface)
Posdtgres database needed to be run in order for the storage service to run
Install postgres in your local machine by following the official documentation.
Once postgres is installed create database and tables using the commands found in feddb text file.
Change port and db names accordingly in the file connector.py
Finally go to StorageService folder and run command flask --app app run
Once all the services (Server, Client, Storage) are running FrontEnd need to be run to create a federated learning job using web Interface. (Instructions found on FedLFrontEnd repo)
Demo for running the web app