refactor: set log level to separate out train args#314
Open
anhuong wants to merge 1 commit intofoundation-model-stack:mainfrom
Open
refactor: set log level to separate out train args#314anhuong wants to merge 1 commit intofoundation-model-stack:mainfrom
anhuong wants to merge 1 commit intofoundation-model-stack:mainfrom
Conversation
- separate out the train args from python logger Signed-off-by: Anh Uong <anh.uong@ibm.com>
Comment on lines
+56
to
+61
| train_logger = logging.getLogger() | ||
| if logger_name: | ||
| train_logger = logging.getLogger(logger_name) | ||
| else: | ||
| train_logger = logging.getLogger() | ||
|
|
||
| set_python_log_level(log_level, train_logger) | ||
| set_python_log_level(log_level) |
Collaborator
There was a problem hiding this comment.
Nice to have a generic function set_python_log_level to set log level of any logger passed to it from any module of the code. Thank you!
Regarding function set_log_level, according to me, it is called to set root log level in the code based on either CLI using train_argsor ENV variable. Hence, I believe, if we don't want to call set_python_log_level twice in the function set_log_level, we can modify the code in function set_log_level as below:
set_python_log_level(log_level)
train_logger = logging.getLogger()
if logger_name:
train_logger = logging.getLogger(logger_name)
return train_args, train_logger
Call set_python_log_level(log_level), will set the root log level and train_logger with or without logger_name, will inherit the root log level.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the change
Separate out python logging and setting log level with setting log level using train_args and altering
train_args.log_levelto match python logging level.Related issue number
How to verify the PR
Was the PR tested