def get_loggers(self) -> Dict[str, ILogger]: """Returns the logger for a run.""" loggers = self._loggers or {} is_logger_exists = lambda logger_fn: any( isinstance(x, logger_fn) for x in loggers.values()) if not is_logger_exists(ConsoleLogger): loggers["_console"] = ConsoleLogger() if self._logdir is not None and not is_logger_exists(CSVLogger): loggers["_csv"] = CSVLogger(logdir=self._logdir) if self._logdir is not None and not is_logger_exists( TensorboardLogger): loggers["_tensorboard"] = TensorboardLogger( logdir=os.path.join(self._logdir, "tensorboard")) return loggers
def get_loggers(self) -> Dict[str, ILogger]: """Returns the loggers for the experiment.""" loggers = self._loggers or {} logger_exists = lambda logger_fn: any( isinstance(x, logger_fn) for x in loggers.values() ) if not logger_exists(ConsoleLogger): loggers["_console"] = ConsoleLogger() if self._logdir is not None and not logger_exists(CSVLogger): # @TODO: remove postfix loggers["_csv"] = CSVLogger(logdir=self._logdir, use_logdir_postfix=True) if self._logdir is not None and not logger_exists(TensorboardLogger): # @TODO: remove postfix loggers["_tensorboard"] = TensorboardLogger( logdir=self._logdir, use_logdir_postfix=True ) return loggers
def get_loggers(self) -> Dict[str, ILogger]: """Returns the loggers for the run.""" loggers_params = self._config.get("loggers", {}) loggers = REGISTRY.get_from_params(**loggers_params) is_logger_exists = lambda logger_fn: any( isinstance(x, logger_fn) for x in loggers.values()) if not is_logger_exists(ConsoleLogger): loggers["_console"] = ConsoleLogger() if self._logdir is not None and not is_logger_exists(CSVLogger): loggers["_csv"] = CSVLogger(logdir=self._logdir, use_logdir_postfix=True) if self._logdir is not None and not is_logger_exists( TensorboardLogger): loggers["_tensorboard"] = TensorboardLogger( logdir=self._logdir, use_logdir_postfix=True) return loggers
def get_loggers(self) -> Dict[str, ILogger]: """Returns the loggers for the run.""" loggers_params = self._config.loggers or {} loggers = {key: hydra.utils.instantiate(params) for key, params in loggers_params.items()} is_logger_exists = lambda logger_fn: any( isinstance(x, logger_fn) for x in loggers.values() ) if not is_logger_exists(ConsoleLogger): loggers["_console"] = ConsoleLogger() if self._logdir is not None and not is_logger_exists(CSVLogger): loggers["_csv"] = CSVLogger(logdir=self._logdir, use_logdir_postfix=True) if self._logdir is not None and not is_logger_exists(TensorboardLogger): loggers["_tensorboard"] = TensorboardLogger( logdir=self._logdir, use_logdir_postfix=True ) return loggers
def get_loggers(self) -> Dict[str, ILogger]: """Returns the loggers for the run.""" loggers_params = self._config.get("loggers", {}) loggers = { key: REGISTRY.get_from_params(**params) for key, params in loggers_params.items() } is_logger_exists = lambda logger_fn: any( isinstance(x, logger_fn) for x in loggers.values()) if not is_logger_exists(ConsoleLogger): loggers["_console"] = ConsoleLogger() if self._logdir is not None and not is_logger_exists(CSVLogger): loggers["_csv"] = CSVLogger(logdir=self._logdir) if self._logdir is not None and not is_logger_exists( TensorboardLogger): loggers["_tensorboard"] = TensorboardLogger( logdir=os.path.join(self._logdir, "tensorboard")) return loggers