Skip to content

Commit

Permalink
Fixed API page and some headings
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Hellander committed Aug 30, 2024
1 parent 110c188 commit 8eec540
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 26 deletions.
54 changes: 35 additions & 19 deletions docs/apiclient.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Then passing a token as an argument is not required.
>>> from fedn import APIClient
>>> client = APIClient(host="<controller-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:

Expand All @@ -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
Expand All @@ -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("<model-id>", 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.
Expand All @@ -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 <https://github.com/scaleoutsystems/fedn/tree/master/examples/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 <https://github.com/scaleoutsystems/fedn/tree/master/examples/notebooks>`_ .
9 changes: 7 additions & 2 deletions docs/developer.rst
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
2 changes: 1 addition & 1 deletion docs/helpers.rst
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 5 additions & 4 deletions docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -66,4 +67,4 @@ Support
Community support in available in our `Discord
server <https://discord.gg/KMg4VwszAd>`__.

Options are available for `Enterprise support <https://www.scaleoutsystems.com/start#pricing>`__.
For professionals / Enteprise, we offer `Dedicated support <https://www.scaleoutsystems.com/start#pricing>`__.

0 comments on commit 8eec540

Please sign in to comment.