Skip to content

Commit

Permalink
Merge pull request #343 from yasirali0/docs-correction
Browse files Browse the repository at this point in the history
fixed minor grammatical and spelling errors
  • Loading branch information
dunzeng authored Dec 3, 2023
2 parents 7564726 + 92c66e6 commit c0fea85
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This is a example of fedlab installation via Dockerfile
# This is an example of fedlab installation via Dockerfile

# replace the value of TORCH_CONTAINER with pytorch image that satisfies your cuda version
# you can finde it in https://hub.docker.com/r/pytorch/pytorch/tags
# you can find it in https://hub.docker.com/r/pytorch/pytorch/tags
ARG TORCH_CONTAINER=1.5-cuda10.1-cudnn7-runtime

FROM pytorch/pytorch:${TORCH_CONTAINER}
Expand Down
8 changes: 4 additions & 4 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

- Step 1

Find an appropriate base pytorch image for your platform from dockerhub https://hub.docker.com/r/pytorch/pytorch/tags. Then, replace the value of TORCH_CONTAINER in demo dockerfile.
Find an appropriate base PyTorch image for your platform from dockerhub https://hub.docker.com/r/pytorch/pytorch/tags. Then, replace the value of TORCH_CONTAINER in demo dockerfile.

- Step 2

To install specific pytorch version, you need to choose a correct install command, which can be find in https://pytorch.org/get-started/previous-versions/. Then, modify the 16-th command in demo dockerfile.
To install specific PyTorch version, you need to choose a correct install command, which can be found at https://pytorch.org/get-started/previous-versions/. Then, modify the 16-th command in demo dockerfile.

- Step 3

Expand All @@ -17,8 +17,8 @@ Build the images for your own platform by running command below.
- Note

Please be sure using "--gpus all" and "--network=host" when start a docker contrainer:
Please be sure to use "--gpus all" and "--network=host" when starting a docker container:

> $ docker run -itd --gpus all --network=host b23a9c46cd04(image name) /bin/bash
If you are not in China area, it is ok to remove line 11,12 and "-i https://pypi.mirrors.ustc.edu.cn/simple/" in line 19.
If you are not in China area, it is ok to remove line 11, 12 and "-i https://pypi.mirrors.ustc.edu.cn/simple/" in line 19.
6 changes: 3 additions & 3 deletions docs/source/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Introduction

Federated learning (FL), proposed by Google at the very beginning, is recently a burgeoning research area of machine learning, which aims to protect individual data privacy in distributed machine learning process, especially in finance, smart healthcare and edge computing. Different from traditional data-centered distributed machine learning, participants in FL setting utilize localized data to train local model, then leverages specific strategies with other participants to acquire the final model collaboratively, avoiding direct data sharing behavior.

To relieve the burden of researchers in implementing FL algorithms and emancipate FL scientists from repetitive implementation of basic FL setting, we introduce highly customizable framework **FedLab** in this work. **FedLab** is builded on the top of `torch.distributed <https://pytorch.org/docs/stable/distributed.html>`_ modules and provides the necessary modules for FL simulation, including communication, compression, model optimization, data partition and other functional modules. **FedLab** users can build FL simulation environment with custom modules like playing with LEGO bricks. For better understanding and easy usage, FL algorithm benchmark implemented in **FedLab** are also presented.
To relieve the burden of researchers in implementing FL algorithms and emancipate FL scientists from repetitive implementation of basic FL setting, we introduce a highly customizable framework **FedLab** in this work. **FedLab** is built on the top of `torch.distributed <https://pytorch.org/docs/stable/distributed.html>`_ modules and provides the necessary modules for FL simulation, including communication, compression, model optimization, data partition and other functional modules. **FedLab** users can build FL simulation environment with custom modules like playing with LEGO bricks. For better understanding and easy usage, FL algorithm benchmarks implemented in **FedLab** are also presented.

For more details, please read our `full paper`__.

Expand Down Expand Up @@ -95,7 +95,7 @@ Experimental Scene
Standalone
-----------

**FedLab** implements ``SerialTrainer`` for FL simulation in single system process. ``SerialTrainer`` allows user to simulate a FL system with multiple clients executing one by one in serial in one ``SerialTrainer``. It is designed for simulation in environment with limited computation resources.
**FedLab** implements ``SerialTrainer`` for FL simulation in single system process. ``SerialTrainer`` allows user to simulate a FL system with multiple clients executing one by one in serial in one ``SerialTrainer``. It is designed for simulation in environment with limited computational resources.

.. image:: ../imgs/fedlab-SerialTrainer.svg
:align: center
Expand All @@ -108,7 +108,7 @@ Standalone
Cross-process
-------------

**FedLab** enables FL simulation tasks to be deployed on multiple processes with correct network configuration (these processes can be run on single or multiple machines). More flexibly in parallel, ``SerialTrainer`` can replace the regular ``Trainer`` directly. Users can balance the calculation burden among processes by choosing different ``Trainer``. In practice, machines with more computation resources can be assigned with more workload of calculation.
**FedLab** enables FL simulation tasks to be deployed on multiple processes with correct network configuration (these processes can be run on single or multiple machines). More flexibly in parallel, ``SerialTrainer`` can replace the regular ``Trainer`` directly. Users can balance the calculation burden among processes by choosing different ``Trainer``. In practice, machines with more computational resources can be assigned with more workload of calculation.

.. note::

Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorials/dataset_partition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Federated Dataset and DataPartitioner
*************************************

Sophisticated in real world, FL need to handle various kind of data distribution scenarios, including
Sophisticated in real world, FL needs to handle various kinds of data distribution scenarios, including
iid and non-iid scenarios. Though there already exists some datasets and partition schemes for published data benchmark,
it still can be very messy and hard for researchers to partition datasets according to their specific
research problems, and maintain partition results during simulation. FedLab provides :class:`fedlab.utils.dataset.partition.DataPartitioner` that allows you to use pre-partitioned datasets as well as your own data. :class:`DataPartitioner` stores sample indices for each client given a data partition scheme. Also, FedLab provides some extra datasets that are used in current FL researches while not provided by official Pytorch :class:`torchvision.datasets` yet.
Expand Down
14 changes: 7 additions & 7 deletions docs/source/tutorials/distributed_communication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Distributed Communication
Initialize distributed network
======================================

FedLab uses `torch.distributed <https://pytorch.org/docs/stable/distributed.html>`_ as point-to-point communication tools. The communication backend is Gloo as default. FedLab processes send/receive data through TCP network connection. Here is the details of how to initialize the distributed network.
FedLab uses `torch.distributed <https://pytorch.org/docs/stable/distributed.html>`_ as point-to-point communication tools. The communication backend is Gloo as default. FedLab processes send/receive data through TCP network connection. Here are the details of how to initialize the distributed network.

You need to assign right ethernet to :class:`DistNetwork`, making sure ``torch.distributed`` network initialization works. :class:`DistNetwork` is for quickly network configuration, which you can create one as follows:
You need to assign right ethernet to :class:`DistNetwork`, making sure ``torch.distributed`` network initialization works. :class:`DistNetwork` is for quick network configuration, which you can create as follows:

.. code-block:: python
Expand All @@ -29,7 +29,7 @@ You need to assign right ethernet to :class:`DistNetwork`, making sure ``torch.d
- Make sure ``world_size`` is the same across process.
- Rank should be different (from ``0`` to ``world_size-1``).
- world_size = 1 (server) + client number.
- The ethernet is None as default. torch.distributed will try finding the right ethernet automatically.
- The ethernet is None as default. ``torch.distributed`` will try finding the right ethernet automatically.
- The ``ethernet_name`` must be checked (using ``ifconfig``). Otherwise, network initialization would fail.

If the automatically detected interface does not work, users are required to assign a right network interface for Gloo, by assigning in code or setting the environment variables ``GLOO_SOCKET_IFNAME``, for example ``export GLOO_SOCKET_IFNAME=eth0`` or ``os.environ['GLOO_SOCKET_IFNAME'] = "eth0"``.
Expand All @@ -45,7 +45,7 @@ If the automatically detected interface does not work, users are required to ass
Point-to-point communication
=============================

In recent update, we hide the communication details from user and provide simple APIs. :class:`DistNetwork` now provies two basic communication APIs: :meth:`send()` and :meth:`recv()`. These APIs suppor flexible pytorch tensor communication.
In recent update, we hide the communication details from user and provide simple APIs. :class:`DistNetwork` now provies two basic communication APIs: :meth:`send()` and :meth:`recv()`. These APIs support flexible pytorch tensor communication.

**Sender process**:

Expand Down Expand Up @@ -80,7 +80,7 @@ In recent update, we hide the communication details from user and provide simple
Further understanding of FedLab communication
================================================

FedLab pack content into a pre-defined package data structure. :meth:`send()` and :meth:`recv()` are implemented like:
FedLab packs content into a pre-defined package data structure. :meth:`send()` and :meth:`recv()` are implemented like:

.. code-block:: python
Expand Down Expand Up @@ -123,7 +123,7 @@ Currently, you can create a network package from following methods:
tensor_list = [torch.rand(size) for size in tensor_sizes]
package = Package(content=tensor_list)
3. append a tensor to exist package
3. append a tensor to existing package

.. code-block:: python
Expand All @@ -133,7 +133,7 @@ Currently, you can create a network package from following methods:
new_tensor = torch.Tensor(size=(8,))
package.append_tensor(new_tensor)
4. append a tensor list to exist package
4. append a tensor list to existing package

.. code-block:: python
Expand Down
10 changes: 5 additions & 5 deletions docs/source/tutorials/docker_deployment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The communication APIs of **FedLab** is built on `torch.distributed <https://pyt
Setup docker environment
==========================

In this section, we introduce how to setup a docker image for **FedLab** program. Here we provide the Dockerfile for building a FedLab image. Our FedLab environment is based on PytTorch. Therefore, we just need install **FedLab** on the provided PytTorch image.
In this section, we introduce how to setup a docker image for **FedLab** program. Here we provide the Dockerfile for building a FedLab image. Our FedLab environment is based on PytTorch. Therefore, we just need install **FedLab** on the provided PyTorch image.

Dockerfile:

Expand Down Expand Up @@ -45,9 +45,9 @@ Dockerfile for different platforms

The steps of modifying Dockerfile for different platforms:

- **Step 1:** Find an appropriate base pytorch image for your platform from dockerhub https://hub.docker.com/r/pytorch/pytorch/tags. Then, replace the value of `TORCH_CONTAINER` in demo dockerfile.
- **Step 1:** Find an appropriate base PyTorch image for your platform from dockerhub https://hub.docker.com/r/pytorch/pytorch/tags. Then, replace the value of `TORCH_CONTAINER` in demo dockerfile.

- **Step 2:** To install specific PyTorch version, you need to choose a correct install command, which can be find in https://pytorch.org/get-started/previous-versions/. Then, modify the 16-th command in demo dockerfile.
- **Step 2:** To install specific PyTorch version, you need to choose a correct install command, which can be found at https://pytorch.org/get-started/previous-versions/. Then, modify the 16-th command in demo dockerfile.

- **Step 3:** Build the images for your own platform by running the command below in the dir of Dockerfile.

Expand All @@ -57,12 +57,12 @@ The steps of modifying Dockerfile for different platforms:
.. warning::

Using "--gpus all" and "--network=host" when start a docker container:
Be sure to use "--gpus all" and "--network=host" when starting a docker container:

.. code-block:: shell-session
$ docker run -itd --gpus all --network=host b23a9c46cd04(image name) /bin/bash
If you are not in China area, it is ok to remove line 11,12 and "-i https://pypi.mirrors.ustc.edu.cn/simple/" in line 19.
If you are not in China area, it is ok to remove line 11, 12 and "-i https://pypi.mirrors.ustc.edu.cn/simple/" in line 19.

- **Finally:** Run your FedLab process in the different started containers.

0 comments on commit c0fea85

Please sign in to comment.