Skip to content

Commit

Permalink
Restructure framework tutorial (adap#2233)
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljanes authored and alessiomora committed Aug 30, 2023
1 parent d63dd6f commit 20b765a
Show file tree
Hide file tree
Showing 38 changed files with 97 additions and 78 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ Flower's goal is to make federated learning accessible to everyone. This series

0. **What is Federated Learning?**

[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-0-What-is-FL.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-0-What-is-FL.ipynb))
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial-what-is-federated-learning.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial-what-is-federated-learning.ipynb))

1. **An Introduction to Federated Learning**

[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-1-Intro-to-FL-PyTorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-1-Intro-to-FL-PyTorch.ipynb))
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial-get-started-with-flower-pytorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial-get-started-with-flower-pytorch.ipynb))

2. **Using Strategies in Federated Learning**

[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-2-Strategies-in-FL-PyTorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-2-Strategies-in-FL-PyTorch.ipynb))
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial-use-a-federated-learning-strategy-pytorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial-use-a-federated-learning-strategy-pytorch.ipynb))

3. **Building Strategies for Federated Learning**

[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-3-Building-a-Strategy-PyTorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-3-Building-a-Strategy-PyTorch.ipynb))
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial-build-a-strategy-from-scratch-pytorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial-build-a-strategy-from-scratch-pytorch.ipynb))

4. **Custom Clients for Federated Learning**

[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-4-Client-and-NumPyClient-PyTorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-4-Client-and-NumPyClient-PyTorch.ipynb))
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial-customize-the-client-pytorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial-customize-the-client-pytorch.ipynb))

Stay tuned, more tutorials are coming soon. Topics include **Privacy and Security in Federated Learning**, and **Scaling Federated Learning**.

Expand All @@ -77,18 +77,18 @@ Stay tuned, more tutorials are coming soon. Topics include **Privacy and Securit
## Documentation

[Flower Docs](https://flower.dev/docs):
* [Installation](https://flower.dev/docs/framework/installation.html)
* [Quickstart (TensorFlow)](https://flower.dev/docs/framework/quickstart-tensorflow.html)
* [Quickstart (PyTorch)](https://flower.dev/docs/framework/quickstart-pytorch.html)
* [Quickstart (Hugging Face)](https://flower.dev/docs/framework/quickstart-huggingface.html)
* [Quickstart (PyTorch Lightning [code example])](https://flower.dev/docs/framework/quickstart-pytorch-lightning.html)
* [Installation](https://flower.dev/docs/framework/how-to-install-flower.html)
* [Quickstart (TensorFlow)](https://flower.dev/docs/framework/tutorial-quickstart-tensorflow.html)
* [Quickstart (PyTorch)](https://flower.dev/docs/framework/tutorial-quickstart-pytorch.html)
* [Quickstart (Hugging Face)](https://flower.dev/docs/framework/tutorial-quickstart-huggingface.html)
* [Quickstart (PyTorch Lightning [code example])](https://flower.dev/docs/framework/tutorial-quickstart-pytorch-lightning.html)
* [Quickstart (MXNet)](https://flower.dev/docs/framework/example-mxnet-walk-through.html)
* [Quickstart (Pandas)](https://flower.dev/docs/framework/quickstart-pandas.html)
* [Quickstart (fastai)](https://flower.dev/docs/framework/quickstart-fastai.html)
* [Quickstart (JAX)](https://flower.dev/docs/framework/quickstart-jax.html)
* [Quickstart (scikit-learn)](https://flower.dev/docs/framework/quickstart-scikitlearn.html)
* [Quickstart (Android [TFLite])](https://flower.dev/docs/framework/quickstart-android.html)
* [Quickstart (iOS [CoreML])](https://flower.dev/docs/framework/quickstart-ios.html)
* [Quickstart (Pandas)](https://flower.dev/docs/framework/tutorial-quickstart-pandas.html)
* [Quickstart (fastai)](https://flower.dev/docs/framework/tutorial-quickstart-fastai.html)
* [Quickstart (JAX)](https://flower.dev/docs/framework/tutorial-quickstart-jax.html)
* [Quickstart (scikit-learn)](https://flower.dev/docs/framework/tutorial-quickstart-scikitlearn.html)
* [Quickstart (Android [TFLite])](https://flower.dev/docs/framework/tutorial-quickstart-android.html)
* [Quickstart (iOS [CoreML])](https://flower.dev/docs/framework/tutorial-quickstart-ios.html)

## Flower Baselines

Expand Down
6 changes: 3 additions & 3 deletions dev/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ python -m black -q examples
python -m docformatter -i -r examples

# Notebooks
python -m black --ipynb -q doc/source/tutorial
python -m black --ipynb -q doc/source
KEYS="metadata.celltoolbar metadata.language_info metadata.toc metadata.notify_time metadata.varInspector metadata.accelerator metadata.vscode cell.metadata.id cell.metadata.heading_collapsed cell.metadata.hidden cell.metadata.code_folding cell.metadata.tags cell.metadata.init_cell cell.metadata.vscode"
python -m nbstripout doc/source/tutorial/*.ipynb --extra-keys "$KEYS"
python -m nbstripout doc/source/*.ipynb --extra-keys "$KEYS"
python -m nbstripout examples/*/*.ipynb --extra-keys "$KEYS"

# Markdown
python -m mdformat --number doc/source/tutorial examples
python -m mdformat --number doc/source examples
2 changes: 1 addition & 1 deletion dev/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ echo "- All Python checks passed"
echo "- Start Markdown checks"

echo "- mdformat: start"
python -m mdformat --check --number doc/source/tutorial examples
python -m mdformat --check --number doc/source examples
echo "- mdformat: done"

echo "- All Markdown checks passed"
File renamed without changes
14 changes: 7 additions & 7 deletions doc/source/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ We would like to give our special thanks to all the contributors who made the ne

- **Introduce new "What is Federated Learning?" tutorial** ([#1657](https://github.com/adap/flower/pull/1657), [#1721](https://github.com/adap/flower/pull/1721))

A new [entry-level tutorial](https://flower.dev/docs/tutorial/Flower-0-What-is-FL.html) in our documentation explains the basics of Fedetated Learning. It enables anyone who's unfamiliar with Federated Learning to start their journey with Flower. Forward it to anyone who's interested in Federated Learning!
A new [entry-level tutorial](https://flower.dev/docs/framework/tutorial-what-is-federated-learning.html) in our documentation explains the basics of Fedetated Learning. It enables anyone who's unfamiliar with Federated Learning to start their journey with Flower. Forward it to anyone who's interested in Federated Learning!

- **Introduce new Flower Baseline: FedProx MNIST** ([#1513](https://github.com/adap/flower/pull/1513), [#1680](https://github.com/adap/flower/pull/1680), [#1681](https://github.com/adap/flower/pull/1681), [#1679](https://github.com/adap/flower/pull/1679))

Expand Down Expand Up @@ -144,11 +144,11 @@ We would like to give our special thanks to all the contributors who made the ne

- **Add new custom strategy tutorial section** [#1623](https://github.com/adap/flower/pull/1623)

The Flower tutorial now has a new section that covers implementing a custom strategy from scratch: [Open in Colab](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-3-Building-a-Strategy-PyTorch.ipynb)
The Flower tutorial now has a new section that covers implementing a custom strategy from scratch: [Open in Colab](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial-build-a-strategy-from-scratch-pytorch.ipynb)

- **Add new custom serialization tutorial section** ([#1622](https://github.com/adap/flower/pull/1622))

The Flower tutorial now has a new section that covers custom serialization: [Open in Colab](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-4-Client-and-NumPyClient-PyTorch.ipynb)
The Flower tutorial now has a new section that covers custom serialization: [Open in Colab](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial-customize-the-client-pytorch.ipynb)

- **General improvements** ([#1638](https://github.com/adap/flower/pull/1638), [#1634](https://github.com/adap/flower/pull/1634), [#1636](https://github.com/adap/flower/pull/1636), [#1635](https://github.com/adap/flower/pull/1635), [#1633](https://github.com/adap/flower/pull/1633), [#1632](https://github.com/adap/flower/pull/1632), [#1631](https://github.com/adap/flower/pull/1631), [#1630](https://github.com/adap/flower/pull/1630), [#1627](https://github.com/adap/flower/pull/1627), [#1593](https://github.com/adap/flower/pull/1593), [#1616](https://github.com/adap/flower/pull/1616), [#1615](https://github.com/adap/flower/pull/1615), [#1607](https://github.com/adap/flower/pull/1607), [#1609](https://github.com/adap/flower/pull/1609), [#1608](https://github.com/adap/flower/pull/1608), [#1603](https://github.com/adap/flower/pull/1603), [#1590](https://github.com/adap/flower/pull/1590), [#1580](https://github.com/adap/flower/pull/1580), [#1599](https://github.com/adap/flower/pull/1599), [#1600](https://github.com/adap/flower/pull/1600), [#1601](https://github.com/adap/flower/pull/1601), [#1597](https://github.com/adap/flower/pull/1597), [#1595](https://github.com/adap/flower/pull/1595), [#1591](https://github.com/adap/flower/pull/1591), [#1588](https://github.com/adap/flower/pull/1588), [#1589](https://github.com/adap/flower/pull/1589), [#1587](https://github.com/adap/flower/pull/1587), [#1573](https://github.com/adap/flower/pull/1573), [#1581](https://github.com/adap/flower/pull/1581), [#1578](https://github.com/adap/flower/pull/1578), [#1574](https://github.com/adap/flower/pull/1574), [#1572](https://github.com/adap/flower/pull/1572), [#1586](https://github.com/adap/flower/pull/1586))

Expand Down Expand Up @@ -184,10 +184,10 @@ We would like to give our special thanks to all the contributors who made the ne

Some users reported that Jupyter Notebooks have not always been easy to use on GPU instances. We listened and made improvements to all of our Jupyter notebooks! Check out the updated notebooks here:

- [An Introduction to Federated Learning](https://flower.dev/docs/tutorial/Flower-1-Intro-to-FL-PyTorch.html)
- [Strategies in Federated Learning](https://flower.dev/docs/tutorial/Flower-2-Strategies-in-FL-PyTorch.html)
- [Building a Strategy](https://flower.dev/docs/tutorial/Flower-3-Building-a-Strategy-PyTorch.html)
- [Client and NumPyClient](https://flower.dev/docs/tutorial/Flower-4-Client-and-NumPyClient-PyTorch.html)
- [An Introduction to Federated Learning](https://flower.dev/docs/framework/tutorial-get-started-with-flower-pytorch.html)
- [Strategies in Federated Learning](https://flower.dev/docs/framework/tutorial-use-a-federated-learning-strategy-pytorch.html)
- [Building a Strategy](https://flower.dev/docs/framework/tutorial-build-a-strategy-from-scratch-pytorch.html)
- [Client and NumPyClient](https://flower.dev/docs/framework/tutorial-customize-the-client-pytorch.html)

- **Introduce optional telemetry** ([#1533](https://github.com/adap/flower/pull/1533), [#1544](https://github.com/adap/flower/pull/1544), [#1584](https://github.com/adap/flower/pull/1584))

Expand Down
21 changes: 20 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,26 @@
"writing-documentation": "write-documentation.html",
"apiref-binaries": "apiref-cli.html",
"fedbn-example-pytorch-from-centralized-to-federated": "example-fedbn-pytorch-from-centralized-to-federated.html",


# Restructuring: tutorials
"tutorial/Flower-0-What-is-FL": "tutorial-what-is-federated-learning.html",
"tutorial/Flower-1-Intro-to-FL-PyTorch": "tutorial-get-started-with-flower-pytorch.html",
"tutorial/Flower-2-Strategies-in-FL-PyTorch": "tutorial-use-a-federated-learning-strategy-pytorch.html",
"tutorial/Flower-3-Building-a-Strategy-PyTorch": "tutorial-build-a-strategy-from-scratch-pytorch.html",
"tutorial/Flower-4-Client-and-NumPyClient-PyTorch": "tutorial-customize-the-client-pytorch.html",
"quickstart-pytorch": "tutorial-quickstart-pytorch.html",
"quickstart-tensorflow": "tutorial-quickstart-tensorflow.html",
"quickstart-huggingface": "tutorial-quickstart-huggingface.html",
"quickstart-jax": "tutorial-quickstart-jax.html",
"quickstart-pandas": "tutorial-quickstart-pandas.html",
"quickstart-fastai": "tutorial-quickstart-fastai.html",
"quickstart-pytorch-lightning": "tutorial-quickstart-pytorch-lightning.html",
"quickstart-mxnet": "tutorial-quickstart-mxnet.html",
"quickstart-scikitlearn": "tutorial-quickstart-scikitlearn.html",
"quickstart-xgboost": "tutorial-quickstart-xgboost.html",
"quickstart-android": "tutorial-quickstart-android.html",
"quickstart-ios": "tutorial-quickstart-ios.html",

# Restructuring: how-to guides
"install-flower": "how-to-install-flower.html",
"configure-clients": "how-to-configure-clients.html",
Expand Down
6 changes: 3 additions & 3 deletions doc/source/contributor-setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ Install ``flwr`` from a specific GitHub branch (``branch-name``):
Open Jupyter Notebooks on Google Colab
--------------------------------------

Open the notebook ``doc/source/tutorial/Flower-1-Intro-to-FL-PyTorch.ipynb``:
Open the notebook ``doc/source/tutorial-get-started-with-flower-pytorch.ipynb``:

- https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-1-Intro-to-FL-PyTorch.ipynb
- https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial-get-started-with-flower-pytorch.ipynb

Open a development version of the same notebook from branch `branch-name` by changing ``main`` to ``branch-name`` (right after ``blob``):

- https://colab.research.google.com/github/adap/flower/blob/branch-name/doc/source/tutorial/Flower-1-Intro-to-FL-PyTorch.ipynb
- https://colab.research.google.com/github/adap/flower/blob/branch-name/doc/source/tutorial-get-started-with-flower-pytorch.ipynb
38 changes: 19 additions & 19 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,31 @@ A learning-oriented series of federated learning tutorials, the best place to st
:maxdepth: 1
:caption: Tutorial

tutorial/Flower-0-What-is-FL
tutorial/Flower-1-Intro-to-FL-PyTorch
tutorial/Flower-2-Strategies-in-FL-PyTorch
tutorial/Flower-3-Building-a-Strategy-PyTorch
tutorial/Flower-4-Client-and-NumPyClient-PyTorch
tutorial-what-is-federated-learning
tutorial-get-started-with-flower-pytorch
tutorial-use-a-federated-learning-strategy-pytorch
tutorial-build-a-strategy-from-scratch-pytorch
tutorial-customize-the-client-pytorch

.. toctree::
:maxdepth: 1
:caption: Quickstart tutorials
:hidden:

quickstart-pytorch
quickstart-tensorflow
quickstart-huggingface
quickstart-jax
quickstart-pandas
quickstart-fastai
quickstart-pytorch-lightning
quickstart-mxnet
quickstart-scikitlearn
quickstart-xgboost
quickstart-android
quickstart-ios

QUICKSTART TUTORIALS: :ref:`PyTorch <quickstart-pytorch>` | :ref:`TensorFlow <quickstart-tensorflow>` | :ref:`🤗 Transformers <quickstart-huggingface>` | :ref:`JAX <quickstart-jax>` | :ref:`Pandas <quickstart-pandas>` | :ref:`fastai <quickstart-fastai>` | :ref:`PyTorch Lightning <quickstart-pytorch-lightning>` | :ref:`MXNet <quickstart-mxnet>` | :ref:`scikit-learn <quickstart-scikitlearn>` | :ref:`XGBoost <quickstart-xgboost>` | :ref:`Android <quickstart-android>` | :ref:`iOS <quickstart-ios>`
tutorial-quickstart-pytorch
tutorial-quickstart-tensorflow
tutorial-quickstart-huggingface
tutorial-quickstart-jax
tutorial-quickstart-pandas
tutorial-quickstart-fastai
tutorial-quickstart-pytorch-lightning
tutorial-quickstart-mxnet
tutorial-quickstart-scikitlearn
tutorial-quickstart-xgboost
tutorial-quickstart-android
tutorial-quickstart-ios

QUICKSTART TUTORIALS: :ref:`PyTorch <tutorial-quickstart-pytorch>` | :ref:`TensorFlow <tutorial-quickstart-tensorflow>` | :ref:`🤗 Transformers <tutorial-quickstart-huggingface>` | :ref:`JAX <tutorial-quickstart-jax>` | :ref:`Pandas <tutorial-quickstart-pandas>` | :ref:`fastai <tutorial-quickstart-fastai>` | :ref:`PyTorch Lightning <tutorial-quickstart-pytorch-lightning>` | :ref:`MXNet <tutorial-quickstart-mxnet>` | :ref:`scikit-learn <tutorial-quickstart-scikitlearn>` | :ref:`XGBoost <tutorial-quickstart-xgboost>` | :ref:`Android <tutorial-quickstart-android>` | :ref:`iOS <tutorial-quickstart-ios>`

.. grid:: 2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Building a Strategy\n",
"# Build a strategy from scratch\n",
"\n",
"Welcome to the third part of the Flower federated learning tutorial. In previous parts of this tutorial, we introduced federated learning with PyTorch and Flower ([part 1](https://flower.dev/docs/tutorial/Flower-1-Intro-to-FL-PyTorch.html)) and we learned how strategies can be used to customize the execution on both the server and the clients ([part 2](https://flower.dev/docs/tutorial/Flower-2-Strategies-in-FL-PyTorch.html)).\n",
"Welcome to the third part of the Flower federated learning tutorial. In previous parts of this tutorial, we introduced federated learning with PyTorch and Flower ([part 1](https://flower.dev/docs/framework/tutorial-get-started-with-flower-pytorch.html)) and we learned how strategies can be used to customize the execution on both the server and the clients ([part 2](https://flower.dev/docs/framework/tutorial-use-a-federated-learning-strategy-pytorch.html)).\n",
"\n",
"In this notebook, we'll continue to customize the federated learning system we built previously by creating a custom version of FedAvg (again, using [Flower](https://flower.dev/) and [PyTorch](https://pytorch.org/)).\n",
"\n",
Expand Down Expand Up @@ -493,7 +493,7 @@
"\n",
"There's a dedicated `#questions` channel if you need help, but we'd also love to hear who you are in `#introductions`!\n",
"\n",
"The [Flower Federated Learning Tutorial - Part 4](https://flower.dev/docs/tutorial/Flower-4-Client-and-NumPyClient-PyTorch.html) introduces `Client`, the flexible API underlying `NumPyClient`."
"The [Flower Federated Learning Tutorial - Part 4](https://flower.dev/docs/framework/tutorial-customize-the-client-pytorch.html) introduces `Client`, the flexible API underlying `NumPyClient`."
]
}
],
Expand Down
Loading

0 comments on commit 20b765a

Please sign in to comment.