From 8eec5404e166e320185ca4547bd184d3d11804c9 Mon Sep 17 00:00:00 2001 From: Andreas Hellander Date: Fri, 30 Aug 2024 13:11:33 +0200 Subject: [PATCH] Fixed API page and some headings --- docs/apiclient.rst | 54 ++++++++++++++++++++++++++++--------------- docs/developer.rst | 9 ++++++-- docs/helpers.rst | 2 +- docs/introduction.rst | 9 ++++---- 4 files changed, 48 insertions(+), 26 deletions(-) diff --git a/docs/apiclient.rst b/docs/apiclient.rst index 6097db570..034709a06 100644 --- a/docs/apiclient.rst +++ b/docs/apiclient.rst @@ -39,7 +39,7 @@ Then passing a token as an argument is not required. >>> from fedn import APIClient >>> client = APIClient(host="", secure=True, verify=True) -**Set the active package and seed model** +**Set the active compute package and seed model** To set the active compute package in the FEDn Studio Project: @@ -52,13 +52,8 @@ To set the active compute package in the FEDn Studio Project: **Start a training session** -Once the active package and seed model are set, you can connect clients to the network and start training models. The following code snippet starts a traing session: - -.. code-block:: python - - session = client.start_session(id="session_name") - -**Run training sessions using the Python APIClient** +Once the active package and seed model are set, you can connect clients to the network and start training models. To run a training session +using the default aggregator (FedAvg): .. code:: python @@ -72,17 +67,38 @@ Once the active package and seed model are set, you can connect clients to the n >>> model_id = models[-1]['model'] >>> validations = client.get_validations(model_id=model_id) -**Accessing global models** +To run a session using the FedAdam aggregator using custom hyperparamters: + +.. code-block:: python + + >>> session_id = "experiment_fedadam" -You can also access global model updates via the APIClient: + >>> session_config = { + "helper": "numpyhelper", + "id": session_id, + "aggregator": "fedopt", + "aggregator_kwargs": { + "serveropt": "adam", + "learning_rate": 1e-2, + "beta1": 0.9, + "beta2": 0.99, + "tau": 1e-4 + }, + "model_id": seed_model['model'], + "rounds": 10 + } + + >>> result_fedadam = client.start_session(**session_config) + +**Download a global model** + +To download a global model and write it to file: .. code:: python >>> ... >>> client.download_model("", path="model.npz") -Please see :py:mod:`fedn.network.api` for more details on how to use the APIClient. - **List data** Other than starting training sessions, the APIClient can be used to get data from the network, such as sessions, models etc. All entities are represented and they all work in a similar fashion. @@ -101,17 +117,17 @@ Entities represented in the APIClient are: * statuses * validations -The following code snippet shows how to list all sessions: - +To list all sessions: .. code-block:: python - sessions = client.get_sessions() + >>> sessions = client.get_sessions() -And the following code snippet shows how to get a specific session: +To get a specific session: .. code-block:: python - session = client.get_session(id="session_name") - + >>> session = client.get_session(id="session_name") -For more information on how to use the APIClient, see the :py:mod:`fedn.network.api.client`, and the example `Notebooks `_. +For more information on how to use the APIClient, see the :py:mod:`fedn.network.api.client`, and the collection of example Jupyter Notebooks: + +- `API Example `_ . \ No newline at end of file diff --git a/docs/developer.rst b/docs/developer.rst index bb30c6f00..a631657f7 100644 --- a/docs/developer.rst +++ b/docs/developer.rst @@ -1,7 +1,12 @@ .. _developer-label: -Local development sandbox -========================= +================ +Developer guide +================ + + +Pseudo-distributed sandbox +=========================== .. note:: These instructions are for users wanting to set up a bare-minimum local deployment of FEDn (without FEDn Studio). diff --git a/docs/helpers.rst b/docs/helpers.rst index 8f89a8317..277ec1c40 100644 --- a/docs/helpers.rst +++ b/docs/helpers.rst @@ -1,6 +1,6 @@ .. _helper-label: -Model Serialization/Deserialization +Model marshalling =================================== In federated learning, model updates need to be serialized and deserialized in order to be diff --git a/docs/introduction.rst b/docs/introduction.rst index a8857ca7d..e4d77283e 100644 --- a/docs/introduction.rst +++ b/docs/introduction.rst @@ -13,10 +13,11 @@ The server aggregates and combines the gradients from multiple participants to u This iterative process allows the global model to improve without the need to share the raw data. -FEDn: An enterprise-ready federated learning framework -------------------------------------------------------- +The FEDn framework +-------------------- -Our goal is to provide a federated learning framework that is both secure, scalable and easy-to-use. We believe that that minimal code change should be needed to progress from early proof-of-concepts to production. This is reflected in our core design: +The goal with FEDn is to provide a federated learning framework that is secure, scalable and easy-to-use. Our ambition is that FEDn supports the full journey from early +testing/exploration, through pilot projects, to real-world depoyments and integration. We believe that that minimal code change should be needed to progress from early proof-of-concepts to production. This is reflected in our core design: - **Minimal server-side complexity for the end-user**. Running a proper distributed FL deployment is hard. With FEDn Studio we seek to handle all server-side complexity and provide a UI, REST API and a Python interface to help users manage FL experiments and track metrics in real time. @@ -66,4 +67,4 @@ Support Community support in available in our `Discord server `__. -Options are available for `Enterprise support `__. \ No newline at end of file +For professionals / Enteprise, we offer `Dedicated support `__. \ No newline at end of file