fluke.utils.log
¶
This submodule provides logging utilities.
Classes included in fluke.utils.log
Basic logger. |
|
Weights and Biases logger. |
|
TensorBoard logger. |
|
ClearML logger. |
class fluke.utils.log.Log
- class fluke.utils.log.Log(**kwargs: dict[str, Any])[source]¶
Basic logger. This class is used to log the performance of the global model and the communication costs during the federated learning process. The logging happens in the console.
- add_scalars(key: Any, values: dict[str, float], round: int) None [source]¶
Add scalars to the logger.
- init(**kwargs: dict[str, Any]) None [source]¶
Initialize the logger. The initialization is done by printing the configuration in the console.
- Parameters:
**kwargs – The configuration.
- message_received(message: Message) None [source]¶
Update the communication costs.
- Parameters:
message (Message) – The message received.
class fluke.utils.log.WandBLog
- class fluke.utils.log.WandBLog(**config)[source]¶
Bases:
Log
Weights and Biases logger. This class is used to log the performance of the global model and the communication costs during the federated learning process on Weights and Biases.
See also
For more information on Weights and Biases, see the Weights and Biases documentation.
- Parameters:
**config – The configuration for Weights and Biases.
class fluke.utils.log.TensorboardLog
- class fluke.utils.log.TensorboardLog(**config)[source]¶
Bases:
Log
TensorBoard logger. This class is used to log the performance of the global model and the communication costs during the federated learning process on TensorBoard
See also
For more information on TensorBoard, see the official documentation.
- Parameters:
**config – The configuration for TensorBoard.
class fluke.utils.log.ClearMLLog
- class fluke.utils.log.ClearMLLog(**config)[source]¶
Bases:
TensorboardLog
ClearML logger. This class is used to log the performance of the global model and the communication costs during the federated learning process on ClearML.
Note
The ClearML logger takes advantage of the TensorBoard logger, thus the logging also happens on TensorBoard. The logging folder is “./runs/{experiment_name}_{timestamp}”.
See also
For more information on ClearML, see the official documentation.
- Parameters:
**config – The configuration for ClearML.
Functions¶
- fluke.utils.log.get_logger(lname: str, **kwargs: dict[str, Any]) Log [source]¶
Get a logger from its name. This function is used to get a logger from its name. It is used to dynamically import loggers. The supported loggers are the ones defined in the
fluke.utils.log
module, but it can handle any logger defined by the user.Note
To use a custom logger, it must be defined in a module and the full model name must be provided in the configuration file. For example, if the logger
MyLogger
is defined in the modulemy_module
(i.e., a file calledmy_module.py
), the logger name must bemy_module.MyLogger
. The other logger’s parameters must be passed as in the following example:logger: name: my_module.MyLogger param1: value1 param2: value2 ...
- Parameters:
lname (str) – The name of the logger.
**kwargs – The keyword arguments to pass to the logger’s constructor.
- Returns:
The logger.
- Return type:
Log | WandBLog | ClearMLLog | TensorboardLog