From b0b51e78740a0c35e64b0cba8f99880f9467baa5 Mon Sep 17 00:00:00 2001 From: brian khuu Date: Thu, 18 Apr 2024 14:44:29 +1000 Subject: [PATCH] *.py: refactor logging.basicConfig() --- convert-llama-ggml-to-gguf.py | 5 +---- scripts/run-with-preset.py | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/convert-llama-ggml-to-gguf.py b/convert-llama-ggml-to-gguf.py index 5496a50ef..97e6ff853 100755 --- a/convert-llama-ggml-to-gguf.py +++ b/convert-llama-ggml-to-gguf.py @@ -408,10 +408,7 @@ def handle_args(): def main(): cfg = handle_args() - if cfg.verbose: - logging.basicConfig(level=logging.DEBUG) - else: - logging.basicConfig(level=logging.INFO) + logging.basicConfig(level=logging.DEBUG if cfg.verbose else logging.INFO) logger.info(f'* Using config: {cfg}') logger.warning('=== WARNING === Be aware that this conversion script is best-effort. Use a native GGUF model if possible. === WARNING ===') if cfg.model_metadata_dir is None and (cfg.gqa == 1 or cfg.eps == '5.0e-06'): diff --git a/scripts/run-with-preset.py b/scripts/run-with-preset.py index fe84cbc7c..3c62c557f 100755 --- a/scripts/run-with-preset.py +++ b/scripts/run-with-preset.py @@ -67,10 +67,7 @@ if not known_args.yaml_files and not unknown_args: parser.print_help() sys.exit(0) -if known_args.verbose: - logging.basicConfig(level=logging.DEBUG) -else: - logging.basicConfig(level=logging.INFO) +logging.basicConfig(level=logging.DEBUG if known_args.verbose else logging.INFO) props = dict()