Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history


optimizer back to lf
  • Loading branch information
continue-revolution committed Feb 2, 2023
2 parents 19b9c10 + 1ac6081 commit 31e3249
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 46 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ puffer
landmark
coqa
.idea
out/
out/
build/
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# -- Project information -----------------------------------------------------

project = 'fedscale'
copyright = '2022, FedScale Team'
copyright = '2023, FedScale Team'
author = 'FedScale Team'

# The full version, including alpha/beta/rc tags
Expand Down
22 changes: 11 additions & 11 deletions docs/source/fedscale.cloud.aggregation.rst
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
fedscale.cloud.aggregation package
=================================

.. Subpackages
.. -----------
.. .. toctree::
.. :maxdepth: 4
.. fedscale.cloud.aggregation.android
==================================

Submodules
----------

fedscale.cloud.aggregation.aggregator module
-------------------------------------------
--------------------------------------------

.. automodule:: fedscale.cloud.aggregation.aggregator
:members:
:undoc-members:
:show-inheritance:

fedscale.cloud.aggregation.android\_aggregator module
-----------------------------------------------------

.. automodule:: fedscale.cloud.aggregation.android_aggregator
:members:
:undoc-members:
:show-inheritance:

fedscale.cloud.aggregation.optimizers module
-------------------------------------------
--------------------------------------------

.. automodule:: fedscale.cloud.aggregation.optimizers
:members:
Expand Down
68 changes: 42 additions & 26 deletions docs/source/fedscale.cloud.execution.rst
Original file line number Diff line number Diff line change
@@ -1,48 +1,64 @@
fedscale.cloud.execution package
===============================
================================

Submodules
----------

.. fedscale.cloud.execution.client module
.. -------------------------------------
fedscale.cloud.execution.client\_base module
--------------------------------------------

.. .. automodule:: fedscale.cloud.execution.client
.. :members:
.. :undoc-members:
.. :show-inheritance:
.. automodule:: fedscale.cloud.execution.client_base
:members:
:undoc-members:
:show-inheritance:

.. fedscale.cloud.execution.data\_processor module
.. ----------------------------------------------
fedscale.cloud.execution.data\_processor module
-----------------------------------------------

.. .. automodule:: fedscale.cloud.execution.data_processor
.. :members:
.. :undoc-members:
.. :show-inheritance:
.. automodule:: fedscale.cloud.execution.data_processor
:members:
:undoc-members:
:show-inheritance:

fedscale.cloud.execution.executor module
---------------------------------------
----------------------------------------

.. automodule:: fedscale.cloud.execution.executor
:members:
:undoc-members:
:show-inheritance:

.. fedscale.cloud.execution.optimizers module
.. -----------------------------------------
fedscale.cloud.execution.optimizers module
------------------------------------------

.. automodule:: fedscale.cloud.execution.optimizers
:members:
:undoc-members:
:show-inheritance:

fedscale.cloud.execution.rl\_client module
------------------------------------------

.. .. automodule:: fedscale.cloud.execution.optimizers
.. :members:
.. :undoc-members:
.. :show-inheritance:
.. automodule:: fedscale.cloud.execution.rl_client
:members:
:undoc-members:
:show-inheritance:

.. fedscale.cloud.execution.rlclient module
.. ---------------------------------------
fedscale.cloud.execution.tensorflow\_client module
--------------------------------------------------

.. .. automodule:: fedscale.cloud.execution.rlclient
.. :members:
.. :undoc-members:
.. :show-inheritance:
.. automodule:: fedscale.cloud.execution.tensorflow_client
:members:
:undoc-members:
:show-inheritance:

fedscale.cloud.execution.torch\_client module
---------------------------------------------

.. automodule:: fedscale.cloud.execution.torch_client
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------
Expand Down
12 changes: 6 additions & 6 deletions docs/source/fedscale.cloud.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fedscale.cloud package
=====================
======================

Subpackages
-----------
Expand All @@ -14,39 +14,39 @@ Submodules
----------

fedscale.cloud.client\_manager module
------------------------------------
-------------------------------------

.. automodule:: fedscale.cloud.client_manager
:members:
:undoc-members:
:show-inheritance:

fedscale.cloud.commons module
----------------------------
-----------------------------

.. automodule:: fedscale.cloud.commons
:members:
:undoc-members:
:show-inheritance:

fedscale.cloud.config\_parser module
-----------------------------------
------------------------------------

.. automodule:: fedscale.cloud.config_parser
:members:
:undoc-members:
:show-inheritance:

fedscale.cloud.fllibs module
---------------------------
----------------------------

.. automodule:: fedscale.cloud.fllibs
:members:
:undoc-members:
:show-inheritance:

fedscale.cloud.resource\_manager module
--------------------------------------
---------------------------------------

.. automodule:: fedscale.cloud.resource_manager
:members:
Expand Down
88 changes: 88 additions & 0 deletions docs/source/fedscale.edge.execution.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
fedscale.edge.execution
=======================

`This directory <https://github.com/SymbioticLab/FedScale/tree/master/fedscale/edge/mnn>`__ contains minimum files modified from `MNN Android
Demo <https://github.com/alibaba/MNN/tree/master/project/android/demo>`__.
The training and testing will be conducted by MNN C++ backend, while the
task execution and communication with server will be managed by Java.
The sample has been tested upon image classification with a simple
linear model and a small subset of
`ImageNet-MINI <https://www.kaggle.com/datasets/ifigotin/imagenetmini-1000>`__.
This documentation contains a step-by-step tutorial on how to download,
build and config this app on your own device, and modify this app for
your own implementation and deployment.

Download and build sample android app
-------------------------------------

1. Download and unzip `sample dataset
(TrainTest.zip) <https://drive.google.com/file/d/1nfi3SVzjaE0LPxwj_5DNdqi6rK7BU8kb/view?usp=sharing>`__
to ``assets/`` directory. Remove ``TrainTest.zip`` after unzip to
save space on your mobile device. After unzip, you should see 3 files
and 2 directories under ``assets/``:

1. ``TrainSet``: Training set directory, contains 316 images.
2. ``TestSet``: Testing set directory, contains 34 images.
3. ``conf.json``: Configuration file for mobile app.
4. ``train_labels.txt``: Training label file with format
``<filename> <label>``, where ``<filename>`` is the path after
``TrainSet/``.
5. ``test_labels.txt``: Testing label file with the same format as
``train_labels.txt``.

2. Run ``sh install.sh``. If you are on Windows, please run this command
in WSL. This step will clone MNN, replace `MNN Android
Demo <https://github.com/alibaba/MNN/tree/master/project/android/demo>`__
with FedScale Android Executor under ``MNN/project/android/demo``.
**Note**: you may want to move MNN directory to another directory,
otherwise the full file path might be too long for cmake to build.
3. Install `Android Studio <https://developer.android.com/studio>`__ and
open project ``MNN/project/android/demo``. Download necessary SDKs,
NDKs and CMake when prompted. My version:

- SDK: API 28
- NDK: 20.0.5594570
- Android Gradle Plugin Version: 3.5.3
- Gradle Version: 5.4.1
- Source Compatibility: Java 8
- Target Compatibility: Java 8

4. Make project. Android Studio will compile and build the app for you.

Test this app with default setting
----------------------------------

1. ssh to your own server and run

::

cd fedscale/cloud/aggregation/android
python3 android_aggregator.py --experiment_mode=mobile --num_participants=1 --model=linear

2. Change aggregator IP address inside ``assets/conf.json`` and click
``Run`` inside Android Studio.

Customize your own app
----------------------

1. If you want to use your own dataset, please put your data under
``assets/TrainSet`` and ``assets/TestSet``, make sure that your label
has the same format as my label file.

1. If you want to change the file/dir name under ``assets``, please
make sure to change the corresponding config in ``assets``
attribute inside ``assets/conf.json``.

2. If you want to use your own model for **image classification**,
please either change ``channel``, ``width`` and ``height`` inside
``assets/conf.json`` to your own input and change ``num_classes`` to
your own classes, or override these attributes when sending
``CLIENT_TRAIN`` request.
3. If you want to use your own model for tasks other than image
classification, you may need to write your own JNI C++ trainer and
tester. Please refer to `MNN <https://github.com/alibaba/MNN>`__ for
further development guide. You may also need to change ``channel``,
``width`` and ``height`` inside ``assets/conf.json`` to your own
input and change or remove ``num_classes``.
4. Please note that MNN does not support DropOut and will SegFault
during training. MNN may have other potential bugs.
3 changes: 2 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ Welcome to fedscale's documentation!

fedscale.cloud.aggregation.rst
fedscale.cloud.execution.rst
fedscale.edge.execution.rst

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
* :ref:`search`

0 comments on commit 31e3249

Please sign in to comment.