Maintaining models for aggregation with the state manager
In this section, we will explain state_manager.py,
which handles maintaining the models and necessary volatile information related to the aggregation of local models.
Importing the libraries of the state manager
This code imports the following. The internal libraries for data_struc
, helpers
, and states
are introduced in the Appendix, Exploring Internal Libraries:
import numpy as np import logging import time from typing import Dict, Any from fl_main.lib.util.data_struc import LimitedDict from fl_main.lib.util.helpers import generate_id, generate_model_id from fl_main.lib.util.states import IDPrefix
After importing the necessary libraries, let’s define the state manager class.
Defining the state manager class
The state manager class (Class StateManager
), as seen in state_manager.py
, is defined in the following code:
class StateManager: """ ...