speechbrain.utils.logger module¶
Managing the logger, utilities
- Author
Fang-Pen Lin 2012 https://fangpenlin.com/posts/2012/08/26/good-logging-practice-in-python/
Peter Plantinga 2020
Aku Rouhe 2020
Summary¶
Classes:
TQDM compatible StreamHandler. |
Functions:
Formats number to the appropriate order of magnitude for printing. |
|
Returns a string describing the current Python / SpeechBrain environment. |
|
Setup logging configuration. |
Reference¶
- class speechbrain.utils.logger.TqdmCompatibleStreamHandler(stream=None)[source]¶
Bases:
logging.StreamHandler
TQDM compatible StreamHandler.
Writes and prints should be passed through tqdm.tqdm.write so that the tqdm progressbar doesn’t get messed up.
- speechbrain.utils.logger.setup_logging(config_path='log-config.yaml', overrides={}, default_level=20)[source]¶
Setup logging configuration.
- speechbrain.utils.logger.format_order_of_magnitude(number, abbreviate=True)[source]¶
Formats number to the appropriate order of magnitude for printing.
- Parameters
- Returns
The formatted number. Note that the order of magnitude token is part of the string.
- Return type
Example
>>> print(format_order_of_magnitude(123456)) 123.5k >>> print(format_order_of_magnitude(0.00000123, abbreviate=False)) 1.2 millionths >>> print(format_order_of_magnitude(5, abbreviate=False)) 5
- speechbrain.utils.logger.get_environment_description()[source]¶
Returns a string describing the current Python / SpeechBrain environment.
Useful for making experiments as replicable as possible.
- Returns
The string is formatted ready to be written to a file.
- Return type
Example
>>> get_environment_description().splitlines()[0] 'SpeechBrain system description'