Skip to content

Commit

Permalink
Remove local sandbox instructions from all examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Hellander committed Jul 12, 2024
1 parent e8e8967 commit 2922043
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 176 deletions.
51 changes: 1 addition & 50 deletions examples/FedSimSiam/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,53 +73,4 @@ FedSimSiam's encoder, and evaluated on the feature embeddings of the test images

This is a common method to track FedSimSiam's training progress, as FedSimSiam aims to minimize the distance between the embeddings of similar images.
A high accuracy implies that the feature embeddings for images within the same class are indeed close to each other in the
embedding space, i.e., FedSimSiam learned useful feature embeddings.


Running FEDn in local development mode:
---------------------------------------

Follow the steps above to install FEDn, generate 'package.tgz' and 'seed.tgz'.

Start a pseudo-distributed FEDn network using docker-compose:
.. code-block::
docker compose \
-f ../../docker-compose.yaml \
-f docker-compose.override.yaml \
up
This starts up local services for MongoDB, Minio, the API Server, one Combiner and two clients.
You can verify the deployment using these urls:

- API Server: http://localhost:8092/get_controller_status
- Minio: http://localhost:9000
- Mongo Express: http://localhost:8081

Upload the package and seed model to FEDn controller using the APIClient:

.. code-block::
from fedn import APIClient
client = APIClient(host="localhost", port=8092)
client.set_active_package("package.tgz", helper="numpyhelper")
client.set_active_model("seed.npz")
You can now start a training session with 100 rounds using the API client:

.. code-block::
client.start_session(rounds=100)
Clean up
--------

You can clean up by running

.. code-block::
docker-compose \
-f ../../docker-compose.yaml \
-f docker-compose.override.yaml \
down -v
embedding space, i.e., FedSimSiam learned useful feature embeddings.
44 changes: 5 additions & 39 deletions examples/flower-client/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ a FEDn network. Here you have two main options: using FEDn Studio
(recommended for new users), or a self-managed pseudo-distributed deployment
on your own machine.

If you are using FEDn Studio (recommended):
Using FEDn Studio:
-------------------------------------------

Follow instructions here to register for Studio and start a project: https://fedn.readthedocs.io/en/stable/studio.html.
Follow instructions here to register for Studio and start a project: https://fedn.readthedocs.io/en/stable/quickstart.html.

In your Studio project:

Expand All @@ -73,47 +73,13 @@ Or, if you prefer to use Docker (this might take a long time):
-v $PWD/client.yaml:/app/client.yaml \
-e CLIENT_NUMBER=0 \
-e FEDN_PACKAGE_EXTRACT_DIR=package \
ghcr.io/scaleoutsystems/fedn/fedn:0.9.0 run client -in client.yaml --secure=True --force-ssl
If you are running FEDn in local development mode:
--------------------------------------------------

Deploy a FEDn network on local host (see `https://fedn.readthedocs.io/en/stable/quickstart.html#local-development-deployment-using-docker-compose`).

Use the FEDn API Client to initalize FEDn with the compute package and seed model:

.. code-block::
python init_fedn.py
Create a file 'client.yaml' with the following content:

.. code-block::
network_id: fedn-network
discover_host: api-server
discover_port: 8092
name: myclient
Then start the client (using Docker)

.. code-block::
docker run \
-v $PWD/client.yaml:/app/client.yaml \
--network=fedn_default \
-e CLIENT_NUMBER=0 \
-e FEDN_PACKAGE_EXTRACT_DIR=package \
ghcr.io/scaleoutsystems/fedn/fedn:0.9.0 run client -in client.yaml
ghcr.io/scaleoutsystems/fedn/fedn:0.11.1 run client -in client.yaml --secure=True --force-ssl
Scaling to multiple clients
------------------------------------------------------------------

To scale the experiment with additional clients on the same host, execute the run command
again from another terminal. If running from another host, add another 'client.yaml', install
fedn, and execute the run command. In both cases inject a client number as an environment
To scale the experiment with additional clients on the same host, generate another 'client.yaml' and execute the run command
again from another terminal. Inject a client number as an environment
varible which is used for distributing data (see 'flwr_task.py').

For Unix Operating Systems:
Expand Down
89 changes: 2 additions & 87 deletions examples/monai-2D-mednist/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ Using FEDn Studio:
- `Python 3.8, 3.9, 3.10 or 3.11 <https://www.python.org/downloads>`__
- `A FEDn Studio account <https://fedn.scaleoutsystems.com/signup>`__

If using pseudo-distributed mode with docker-compose:

- `Docker <https://docs.docker.com/get-docker>`__
- `Docker Compose <https://docs.docker.com/compose/install>`__


Creating the compute package and seed model
-------------------------------------------
Expand Down Expand Up @@ -74,11 +69,10 @@ below command we divide the dataset into 10 parts.
python prepare_data.py 10
Using FEDn Studio
-----------------

Follow the guide here to set up your FEDn Studio project and learn how to connect clients (using token authentication): `Studio guide <https://fedn.readthedocs.io/en/stable/studio.html>`__.
Follow the guide here to set up your FEDn Studio project and learn how to connect clients (using token authentication): `Studio guide <https://fedn.readthedocs.io/en/stable/quickstart.html>`__.
On the step "Upload Files", upload 'package.tgz' and 'seed.npz' created above.

Connecting clients:
Expand Down Expand Up @@ -110,83 +104,4 @@ For convenience, there is a Docker image hosted on ghrc.io with fedn preinstalle
-e FEDN_DATA_PATH=/app/data/ \
-e FEDN_CLIENT_SETTINGS_PATH=/app/client_settings.yaml \
-e FEDN_DATA_SPLIT_INDEX=0 \
ghcr.io/scaleoutsystems/fedn/fedn:0.9.0 run client -in client.yaml --force-ssl --secure=True
**NOTE: The following instructions are only for SDK-based client communication and for local development environments using Docker.**


Local development mode using Docker/docker compose
--------------------------------------------------

Follow the steps above to install FEDn, generate 'package.tgz' and 'seed.tgz'.

Start a pseudo-distributed FEDn network using docker-compose:

.. code-block::
docker compose \
-f ../../docker-compose.yaml \
-f docker-compose.override.yaml \
up
This starts up local services for MongoDB, Minio, the API Server, one Combiner and two clients.
You can verify the deployment using these urls:

- API Server: http://localhost:8092/get_controller_status
- Minio: http://localhost:9000
- Mongo Express: http://localhost:8081

Upload the package and seed model to FEDn controller using the APIClient. In Python:

.. code-block::
from fedn import APIClient
client = APIClient(host="localhost", port=8092)
client.set_active_package("package.tgz", helper="numpyhelper")
client.set_active_model("seed.npz")
You can now start a training session with 5 rounds (default):

.. code-block::
client.start_session()
Automate experimentation with several clients
=============================================

If you want to scale the number of clients, you can do so by modifying ``docker-compose.override.yaml``. For example,
in order to run with 3 clients, change the environment variable ``FEDN_NUM_DATA_SPLITS`` to 3, and add one more client
by copying ``client1``.


Access message logs and validation data from MongoDB
====================================================

You can access and download event logs and validation data via the API, and you can also as a developer obtain
the MongoDB backend data using pymongo or via the MongoExpress interface:

- http://localhost:8081/db/fedn-network/

The credentials are as set in docker-compose.yaml in the root of the repository.

Access global models
====================

You can obtain global model updates from the 'fedn-models' bucket in Minio:

- http://localhost:9000

Reset the FEDn deployment
=========================

To purge all data from a deployment incuding all session and round data, access the MongoExpress UI interface and
delete the entire ``fedn-network`` collection. Then restart all services.

Clean up
========
You can clean up by running

.. code-block::
docker-compose -f ../../docker-compose.yaml -f docker-compose.override.yaml down -v
ghcr.io/scaleoutsystems/fedn/fedn:0.11.1 run client -in client.yaml --force-ssl --secure=True

0 comments on commit 2922043

Please sign in to comment.