Skip to content

Latest commit

 

History

History
260 lines (176 loc) · 17.8 KB

example_applications_algorithms.rst

File metadata and controls

260 lines (176 loc) · 17.8 KB

Example Applications

NVIDIA FLARE has several tutorials and examples to help you get started with federated learning and to explore certain features in the :github_nvflare_link:`examples directory <examples>`.

1. Hello World Examples

Can be run from :github_nvflare_link:`hello_world notebook <examples/hello-world/hello_world.ipynb>`.

.. toctree::
  :maxdepth: 1
  :hidden:

  examples/hello_world_examples

1.1. Deep Learning to Federated Learning

1.2. Workflows

1.3. Deep Learning

2. Step-By-Step Example Series

:github_nvflare_link:`Step-by-Step Examples (GitHub) <examples/hello-world/step-by-step/>` - Step-by-step examples series with CIFAR-10 (image data) and HIGGS (tabular data) to showcase different FLARE features, workflows, and APIs.

2.1 CIFAR-10 Image Data Examples

2.2 HIGGS Tabular Data Examples

3. Tutorial Notebooks

4. Federated Learning Algorithms

.. toctree::
  :maxdepth: 2

  examples/fl_algorithms

5. Privacy Preserving Algorithms

Privacy preserving algorithms in NVIDIA FLARE are implemented as :ref:`filters <filters_for_privacy>` that can be applied as data is sent or received between peers.

6. Traditional ML examples

7. Medical Image Analysis

8. Federated Statistics

.. toctree::
  :maxdepth: 1
  :hidden:

  examples/federated_statistics_overview

9. Federated Site Policies

10. Experiment Tracking

.. toctree::
  :maxdepth: 1
  :hidden:

  examples/tensorboard_streaming
  examples/fl_experiment_tracking_mlflow

11. Natural Language Processing (NLP)

12. FL Hierarchical Unification Bridge (HUB)

13. Federated Large Language Model (LLM)

14. Graph Neural Network (GNN)

15. Financial Applications

Setting up a virtual environment for examples and notebooks

It is recommended to set up a virtual environment before installing the dependencies for the examples. Install dependencies for a virtual environment with:

python3 -m pip install --user --upgrade pip
python3 -m pip install --user virtualenv

Once venv is installed, you can use it to create a virtual environment with:

$ python3 -m venv nvflare_example

This will create the nvflare_example directory in current working directory if it doesn't exist, and also create directories inside it containing a copy of the Python interpreter, the standard library, and various supporting files.

Activate the virtualenv by running the following command:

$ source nvflare_example/bin/activate

Installing required packages

In each example folder, install required packages for training:

pip install --upgrade pip
pip install -r requirements.txt

(optional) some examples contain scripts for plotting the TensorBoard event files, if needed, please also install the additional requirements in the example folder:

pip install -r plot-requirements.txt

JupyterLab with your virtual environment for Notebooks

To run examples including notebooks, we recommend using JupyterLab.

After activating your virtual environment, install JupyterLab:

pip install jupyterlab

If you need to register the virtual environment you created so it is usable in JupyterLab, you can register the kernel with:

python -m ipykernel install --user --name="nvflare_example"

Start a Jupyter Lab:

jupyter lab .

When you open a notebook, select the kernel you registered, "nvflare_example", using the dropdown menu at the top right.

Custom Code in Example Apps

There are several ways to make :ref:`custom code <custom_code>` available to clients when using NVIDIA FLARE. Most hello-* examples use a custom folder within the FL application. Note that using a custom folder in the app needs to be :ref:`allowed <troubleshooting_byoc>` when using secure provisioning. By default, this option is disabled in the secure mode. POC mode, however, will work with custom code by default.

In contrast, the :github_nvflare_link:`CIFAR-10 <examples/advanced/cifar10>`, :github_nvflare_link:`prostate segmentation <examples/advanced/prostate>`, and :github_nvflare_link:`BraTS18 segmentation <examples/advanced/brats18>` examples assume that the learner code is already installed on the client's system and available in the PYTHONPATH. Hence, the app folders do not include the custom code there. The PYTHONPATH is set in the run_poc.sh or run_secure.sh scripts of the example. Running these scripts as described in the README will make the learner code available to the clients.