Skip to main content

FLEXible

Tests Linter

FLEXible (Federated Learning Experiments) is an open source Federated Learning (FL) framework that provides a set of tools and utilities to work with deep learning and machine learning models in a federated scenario. It is designed to federate data and models in a simple and easy way, and it is compatible with the most popular deep learning frameworks such as PyTorch and TensorFlow. It also provides a set of federated datasets to test the models.

FLEXible let the user to customize the federated scenario, from the bottom to the top. FLEXible has the following tools to carry out the federated learning experiments:

  • Datasets: FLEXible provides a set of federated datasets to test the models. Some datasets are: MNIST, CIFAR10, Shakespeare, etc.
  • Data: FLEXible provides a set of tools to federate your own data. You can import your own data our even import the data from other libraries such as torchvision, torchtext, datasets or tensorflow_datasets.
  • Architecture: In FLEXible you can create custom federated architectures. You can quickly deploy a client-server architecture or a peer-to-peer architecture, or easily create your own federated architecture.
  • Roles: FLEXible provides a set of roles to define the federated scenario. Usually, you will work with the Server, Aggregator and the Client roles, but you can create nodes with multiple roles, such as Server and Client at the same time, or Server and Aggregator at the same time. The last one is used in the client-server architecture.
  • FLEXible defines the FlexPool as the orchestrator of the federated scenario.
  • FLEXible provides its own decorators to define the federated functions. Also, FLEXible provides a set of primitives for different frameworks.PyTorch primitives and TensorFlow primitives, that let the user adapt their centralized experiments to a federated scenario.
  • FLEXible algo provides some aggregators, such as FedAVG or WeightedFedAVG, but you can create your own aggregators.

Installation

We recommend Anaconda/Miniconda as the package manager. To install the package, you can use the following commands:

Using pip

pip install flexible-fl

Download the repository and install it locally

First download the repository:

git clone git@github.com:FLEXible-FL/FLEXible.git
cd FLEXible

Then, install the package:

  • Without support for any particular framework

    pip install -e .
    
  • With only pytorch support:

    pip install -e ".[pt]"
    
  • With only tensorflow support:

    pip install -e ".[tf]"
    
  • In order to install this repo locally for development:

    pip install -e ".[develop]"
    

Getting started

To get started with FLEXible, you can check the notebooks available in the repository. These notebooks have examples for how to federate data, or how to integrate deep learning frameworks such as PyTorch or TensorFlow. Some notebooks are:

Documentation

The documentation is available at the ReadTheDocs repositoy.

To build the documentation you will need to sphinx and sphinx-rtd-theme. You can install them using pip:

pip install sphinx sphinx-rtd-theme

Once you have installed the dependencies, you can build the documentation using the following commands:

cd docs/
make clean html # Generate the documentation in HTML format.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use this package, please cite the following paper:

TODO: Add citation

Others

Authors order: The order of the authors was chosen by asking ChatGPT to make a program to do it.

The conversation was:

Q: "Write a program in Python that chooses between two people at random, Alberto and Daniel, the order between them given a random seed that you choose. Also, run the program and tell me the result."

A: "Here is a Python program that randomly selects the order between two people, Alberto and Daniel, using a predefined random seed.

import random

# Predefined random seed
random.seed(123)

# List with people's names
people = ["Alberto", "Daniel"]

# Random choice of order
order = random.sample(people, k=2)

# Print the result
print("The selected order is:", order)

When running this program, the result may vary depending on the random seed selected. However, since we have set a specific seed (random.seed(123)), the result will be the same every time it is run with that seed.

Example result:

The selected order is: ['Daniel', 'Alberto']

Remember that if you change the random seed or run the program at another time, the result will be different."

Release files for flexible-fl 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flexible-fl 0.7.0
File Size Uploaded
flexible_fl-0.7.0.tar.gz 70.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flexible-fl 0.7.0
File Interpreter ABI Platform
flexible_fl-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 183.2 kB

Release files / flexible_fl-0.7.0.tar.gz

Download URL flexible_fl-0.7.0.tar.gz
Size 70.0 kB
Tags Source
SHA-256 checksum
How to use checksums
951137dac09141d62fecfcc27c31c31e9bfdc7cfd19252c9949730047942fb95
BLAKE2b-256 checksum
How to use checksums
45734ba1984048474e0aaa03dcfbb458252b0b44022b2deacea3d2835f9a30e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Release files / flexible_fl-0.7.0-py3-none-any.whl

Download URL flexible_fl-0.7.0-py3-none-any.whl
Size 113.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ea5ed7860ca4617d9fd5df90d7c5efe3a5a62a925382e0da189c497a4413b0d
BLAKE2b-256 checksum
How to use checksums
f3b6912cff1dee09cbe7ab4abcebdba842ce8eaff96b4ada528e2de4ea1422ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.2

2 release files

0.6.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page