Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

#396 Trainer constructor cleanup

Merged
Ghost merged 1 commits into Deci-AI:master from deci-ai:feature/SG-266_clean_trainer_ctor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  1. import logging
  2. import logging.config
  3. from super_gradients.common.auto_logging import AutoLoggerConfig
  4. from super_gradients.common.environment.environment_config import DEFAULT_LOGGING_LEVEL
  5. def get_logger(
  6. logger_name: str, training_log_path=None, logs_dir_path=None, log_level=DEFAULT_LOGGING_LEVEL
  7. ) -> logging.Logger:
  8. config_dict = AutoLoggerConfig.generate_config_for_module_name(
  9. module_name=logger_name, training_log_path=training_log_path, logs_dir_path=logs_dir_path, log_level=log_level
  10. )
  11. logging.config.dictConfig(config_dict)
  12. logger: logging.Logger = logging.getLogger(logger_name)
  13. return logger
  14. class ILogger:
  15. """
  16. Provides logging capabilities to the derived class.
  17. """
  18. def __init__(self, logger_name: str = None):
  19. logger_name = logger_name if logger_name else str(self.__module__)
  20. self._logger: logging.Logger = get_logger(logger_name)
Discard
Tip!

Press p or to see the previous file or, n or to see the next file