fl4health.utils.snapshotter module¶
- class AbstractSnapshotter(client)[source]¶
-
- __init__(client)[source]¶
Abstract class for saving and loading the state of the client’s attributes.
- Parameters:
client (BasicClient) – The client to be monitored.
- dict_wrap_attr(name, expected_type)[source]¶
Wrap the attribute in a dictionary if it is not already a dictionary.
- abstract load_attribute(attribute_snapshot, attribute)[source]¶
Abstract method to load the state of the attribute. This method should be implemented based on the type of the attribute and the way it should be loaded.
- class LRSchedulerSnapshotter(client)[source]¶
Bases:
AbstractSnapshotter
[LRScheduler
]
- class NumberSnapshotter(client)[source]¶
Bases:
AbstractSnapshotter
[int
|float
]
- class OptimizerSnapshotter(client)[source]¶
Bases:
AbstractSnapshotter
[Optimizer
]
- class SerializableObjectSnapshotter(client)[source]¶
Bases:
AbstractSnapshotter
[MetricManager
|LossMeter
|ReportsManager
]- load_attribute(attribute_snapshot, attribute)[source]¶
Load the state of the serializable objects (either single or dictionary of them).
- Parameters:
attribute_snapshot (dict[str, Any]) – The snapshot containing the state of the serializable objects.
attribute (dict[str, MetricManager | LossMeter | ReportsManager]) – The serializable objects to be loaded
- Return type:
- save_attribute(attribute)[source]¶
Save the state of the serializable objects (either single or dictionary of them).
- Parameters:
attribute (dict[str, MetricManager | LossMeter | ReportsManager]) – The serializable objects to be saved.
- Returns:
A dictionary containing the state of the serializable objects.
- Return type:
- class TorchModuleSnapshotter(client)[source]¶
Bases:
AbstractSnapshotter
[Module
]