Installation
July 30, 2024 ยท View on GitHub
Installation
The source code can be downloaded through the green "<>Code" button.
For scenarios where you only need to quickly experience YanshiShield and federated learning, we recommend installing in standalone mode, which allows you to quickly start a federated training. For production environments, cluster mode installation is recommended. The SDK for federated development needs to be installed in both installation modes.
SDK Installation
1. Enter YanshiShield code
cd federated-learning
2. Install SDK
Install the SDK according to the underlying machine learning framework. By default, both Tensorflow and Pytorch support:
# for Tensorflow and Pytorch
./deploy/scripts/install_sdk.sh
# for Tensorflow only
./deploy/scripts/install_sdk.sh --runtime=tf
# for Pytorch only
./deploy/scripts/install_sdk.sh --runtime=torch
In the Python 3 environment, verify whether the SDK installation is successful.

3. Install nsfl-ctl
nsfl-ctl is a command line client. Users can use this command to quickly create, delete, and query federated jobs. Run the following commands to install:
./deploy/scripts/install_cli.sh
To verify whether nsfl-ctl is successfully installed, execute the following command, and the comment to the command as shown in the figure below shows that the installation has been successful.
nsfl-ctl

You can add the command parameter --help to view the instructions for using the command
Standalone Mode
For standalone mode, you can choose to run as host processes or containers. For container mode, no installation is required. See the quick start document for container mode. In this mode, you only need to install the coordinator and client components:
1. Install coordinator
./deploy/scripts/install_coordinator.sh
2. Install client
Install the client according to the underlying machine learning framework. By default, both Tensorflow and Pytoch support:
# for Tensorflow and Pytorch
./deploy/scripts/install_client.sh
# for Tensorflow only
./deploy/scripts/install_client.sh --runtime=tf
# for Pytorch only
./deploy/scripts/install_client.sh --runtime=torch
After the installation, please refer to the quick start to experience federated learning.
Cluster Mode
Please refer to Cluster Deployment Guide to complete the deployment of YanshiShield.