From 78c020440622fd2a51d54a0281f90276f3c31982 Mon Sep 17 00:00:00 2001 From: Nathan Fradet Date: Wed, 16 Nov 2022 17:26:51 +0100 Subject: [PATCH] log functions now at INFO level --- torchtoolkit/train.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/torchtoolkit/train.py b/torchtoolkit/train.py index 270671d..b4047cd 100644 --- a/torchtoolkit/train.py +++ b/torchtoolkit/train.py @@ -33,10 +33,11 @@ def select_device(use_cuda: bool = True, log: bool = False) -> device: def log_cuda_info(logger: Logger = None, memory_only: bool = False): r"""Log the info of GPU - :param logger: a logger object, if not given this function will print info. (default: None) + :param logger: a Logger object. By default, this method will log at the INFO level. + If no Logger is given, `print` (stdout) will be used. (default: None) :param memory_only: choose to log only the memory state of GPU. (default: False) """ - log_func = logger.debug if logger is not None else print + log_func = logger.info if logger is not None else print if cuda.is_available(): if not memory_only: log_func('******** GPU INFO ********') @@ -52,10 +53,11 @@ def log_model_parameters(model: Module, logger: Logger = None, model_desc: bool r"""Log the number of parameters of a model :param model: model to analyze. - :param logger: a logger object, if not given this function will print info. (default: None) + :param logger: a Logger object. By default, this method will log at the INFO level. + If no Logger is given, `print` (stdout) will be used. (default: None) :param model_desc: also logs the description of the model, i.e. the modules. (default: True) """ - log_func = logger.debug if logger is not None else print + log_func = logger.info if logger is not None else print if not model_desc: log_func('******** MODEL INFO ********') log_func(model)