From c7aa37cf1a697fab24ca921494cdd9bd948f5d24 Mon Sep 17 00:00:00 2001 From: Roi Tiefenbrunn Date: Tue, 6 Aug 2024 15:02:38 +0300 Subject: [PATCH] [SW-195525] INC Logger: Support ENABLE_CONSOLE values 1/0 Add support for values '1' and '0' for 'ENABLE_CONSOLE' env var Change-Id: I53f71250d7a74d2a8050aa1722b75acaebef0c4c --- .../torch/algorithms/fp8_quant/utils/logger.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/neural_compressor/torch/algorithms/fp8_quant/utils/logger.py b/neural_compressor/torch/algorithms/fp8_quant/utils/logger.py index 432a15008c5..428bb4186ef 100644 --- a/neural_compressor/torch/algorithms/fp8_quant/utils/logger.py +++ b/neural_compressor/torch/algorithms/fp8_quant/utils/logger.py @@ -103,9 +103,9 @@ def __new__(cls): def get_enable_console_val(self): enableConsole = os.environ.get("ENABLE_CONSOLE", "False").upper() - if enableConsole not in ["TRUE", "FALSE"]: - raise Exception("Env var 'ENABLE_CONSOLE' has to be true or false.") - return enableConsole == "TRUE" + if enableConsole not in ["TRUE", "FALSE", "1", "0"]: + raise Exception("Env var 'ENABLE_CONSOLE' has to be 'true' or 'false' ('1' or '0' respectively).") + return enableConsole == "TRUE" or enableConsole == "1" def get_log_level(self): log_level_str = os.environ.get("LOG_LEVEL_HQT", os.environ.get("LOG_LEVEL_ALL"))