π₯ InstallationΒΆ
β‘οΈ Quick Start with GitHub CodespacesΒΆ
The fastest way to start using the library is with GitHub Codespaces. It provides a pre-configured development environment in the cloud, so you can get started without setting up anything locally.
To use GitHub Codespaces:
Create a new Codespace or open an existing one.
Once the environment is ready, the library and its dependencies will already be set up.
Alternatively:
Navigate to the p2pfl repository.
Click on the green
<> Code
button, then select the codespaces tab.Create a new Codespace or open an existing one.
Once the environment is ready, the library and its dependencies will already be set up.
βοΈ Manual Installation (Advanced)ΒΆ
If you prefer a fully manual installation or need to customize the setup, follow these steps:
π¨πΌβπ» For usersΒΆ
To install the library with specific dependencies, you can use one of the following commands:
For PyTorch-related dependencies:
pip install "p2pfl[torch]"
For TensorFlow-related dependencies:
pip install "p2pfl[tensorflow]"
For Ray-related dependencies:
pip install "p2pfl[ray]"
If you want to install all dependencies, you can do so with:
pip install "p2pfl[torch,tensorflow,ray]"
π¨πΌβπ§ For developersΒΆ
π PythonΒΆ
Prerequisite: Before installing the library, ensure that Poetry is installed. If you havenβt installed it yet, follow the instructions in the official Poetry Installation Guide.
git clone https://github.com/pguijas/p2pfl.git
cd p2pfl
poetry install -E torch
Note: You can use the extras (
-E
) flag to install the library with the desired dependencies. Available options are:
torch
: For PyTorch-related dependenciestensorflow
: For TensorFlow-related dependenciesray
: For Ray-related dependencies
If you want to install all dependencies, you can run:
poetry install --all-extras
Additionally, you can use the βno-dev flag to install the library without the development dependencies.
π³ DockerΒΆ
You can also use the library with Docker. We provide a Docker image with the library installed. You can use it as follows:
docker build -t p2pfl .
docker run -it --rm p2pfl bash
π¦ Dependency OverviewΒΆ
This library supports P2P Decentralized Federated Learning with flexibility for different frameworks and backend integrations. You can choose dependencies tailored for your projectβs needs. Below is an overview of the dependency options:
Torch: For PyTorch-based deep learning models, including support for:
torch
: Core PyTorch library.torchvision
: Tools for computer vision tasks.torchmetrics
: Metrics for evaluating models in PyTorch.lightning
: PyTorch Lightning, a framework for high-performance training.
TensorFlow: For TensorFlow-based federated learning setups, including:
tensorflow
: Core TensorFlow library.keras
: High-level API for building and training models in TensorFlow.types-tensorflow
: Type annotations for TensorFlow.
Ray: For distributed computing and orchestration:
ray
: Framework for scaling distributed applications, useful for coordinating computing resources during training.