Skip to content

This repository provides a comprehensive solution and codebase for the migration from centralized to federated learning. It demonstrates centralized training, its drawbacks, and how federated learning addresses these issues. It also serves as a tutorial to guide users through the transition process.

Notifications You must be signed in to change notification settings

WahabMam/From-Centralized-To-Federated

Repository files navigation

From Centralized to Federated Learning

Project Overview

This repository demonstrates the migration from centralized to federated learning using a simple model with the MNIST dataset and Pytorch framework. It serves as a beginner-friendly demo, showcasing how to transition from a centralized system to federated learning while highlighting the advantages of this approach. We have created notebooks that offer comprehensive and clear instructions before each cell of code, making it easy for newcomers to follow along and understand the concepts involved

Getting Started

Prerequisites

  • Python: Ensure you have Python version 3.9.6 installed.

Creating a Virtual Environment

  1. Create a virtual environment:

    python -m venv venv --prompt myenv  # Replace 'myenv' with your preferred environment name
  2. Activate the virtual environment:

    • On Windows:
      venv\Scripts\activate
    • On macOS/Linux:
      source venv/bin/activate

Installation

  1. Install required libraries: Create a requirements.txt file with the necessary packages (e.g., tensorflow, flwr) and include the specific versions. Then run:
    pip install -r requirements.txt

Utility Functions

  1. Review utility files: Take a look at Utils1.py and Utils2.py, which contain utility functions that are helpful throughout the notebooks.

Running the Notebooks

  1. Open and run the notebooks in the following order for better understanding:
    • Centralized_Notebook.ipynb: Understand the centralized training approach.
    • Federated_Notebook.ipynb: Explore the federated learning setup.
    • Comparison.ipynb: Compare the results and insights from both approaches.

About

This repository provides a comprehensive solution and codebase for the migration from centralized to federated learning. It demonstrates centralized training, its drawbacks, and how federated learning addresses these issues. It also serves as a tutorial to guide users through the transition process.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published