> Where does the aggregation happen in code/pt/mammo_learner.py ?

So I'm trying to wrap my head around the code we're supposed to manipulate:

I'm trying to find how to manipulate the aggregation step, but it's not clear to me where that takes place. I would expect global weights to be defined after local_train is called in line 412 but I don't see it. I noticed "global_weights" is called from something named dxo (line 384) but I don't see how it connects to the training taking place. Is there an explanation of how this is done and how we could manipulate it to insert some novelty into the aggregation process?

Posted by: Linardos @ July 11, 2022, 3:02 p.m.

the aggregation method used is specified in the config_fed_server.json file here: https://github.com/Project-MONAI/tutorials/blob/main/federated_learning/breast_density_challenge/code/configs/mammo_fedavg/config/config_fed_server.json#L36.

The reference example uses this built-in aggregator: https://github.com/NVIDIA/NVFlare/blob/dev/nvflare/app_common/aggregators/accumulate_model_aggregator.py.

To change this out for a custom aggregator, create your custom aggregator class, inheriting from the NVFLARE aggregator (https://nvidia.github.io/NVFlare/apidocs/nvflare.app_common.abstract.aggregator.html?highlight=aggregat#module-nvflare.app_common.abstract.aggregator) and point to the custom aggregator in config_fed_server.json. It may be helpful to look at this built-in aggregator as an example: https://github.com/NVIDIA/NVFlare/blob/a23afd7759b36f3885c9de68b461c5ea8358d085/nvflare/app_common/aggregators/intime_accumulate_model_aggregator.py#L45.

Weights are transferred to and from the FL server as data exchange objects (DXOs) https://nvidia.github.io/NVFlare/programming_guide/data_exchange_object.html?highlight=dxo.

Full NVFLARE documentation can be found here: https://nvidia.github.io/NVFlare/index.html.

Posted by: kschmidt @ July 11, 2022, 7:47 p.m.

My question is as follows. If we use a custom model and define our model in a separate model_definition file. Do we need to specify that somehow in the confid_fed_server.json file in the "components" field.
Going through the code makes us feel that we do not need to make any such declarations and the code works fine.

Any suggestions

Posted by: ctestagrose @ Aug. 4, 2022, 6:44 p.m.


You can define your learner here: https://github.com/Project-MONAI/tutorials/blob/20343755a688ab70643907e56dc11f0c487d7662/federated_learning/breast_density_challenge/code/configs/mammo_fedavg/config/config_fed_client.json#L30.

Within your learner, you can call your custom model. In the reference implementation, that's done here: https://github.com/Project-MONAI/tutorials/blob/20343755a688ab70643907e56dc11f0c487d7662/federated_learning/breast_density_challenge/code/pt/learners/mammo_learner.py#L152.

Does this answer your question?

Posted by: challenge-organizer @ Aug. 5, 2022, 3:13 p.m.

There is one other step - In order to save and load global models, NVFLARE needs to know the model architecture. That is defined in the config_fed_server.json file here: https://github.com/Project-MONAI/tutorials/blob/20343755a688ab70643907e56dc11f0c487d7662/federated_learning/breast_density_challenge/code/configs/mammo_fedavg/config/config_fed_server.json#L18

Posted by: challenge-organizer @ Aug. 5, 2022, 3:16 p.m.
Post in this thread