From a6c4b733cb76925c1363dadfe6f6c209b02297b6 Mon Sep 17 00:00:00 2001 From: Ruonan Wang <105281011+rnwang04@users.noreply.github.com> Date: Tue, 13 Jun 2023 16:43:37 +0800 Subject: [PATCH] LLM: Update subprocess to show error message (#8323) * update subprocess * fix style --- python/llm/src/bigdl/llm/ggml/quantize.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/llm/src/bigdl/llm/ggml/quantize.py b/python/llm/src/bigdl/llm/ggml/quantize.py index f28b76a8..31f76962 100644 --- a/python/llm/src/bigdl/llm/ggml/quantize.py +++ b/python/llm/src/bigdl/llm/ggml/quantize.py @@ -91,8 +91,9 @@ def quantize(input_path: str, output_path: str, input_path, output_path, str(quantize_type)) - p = subprocess.Popen(quantize_args.split()) - p.communicate() + p = subprocess.run(quantize_args.split(), capture_output=True) + error_message = p.stderr invalidInputError(not p.returncode, - "Fail to quantize {}.".format(str(input_path))) + "Fail to quantize {}, error message is {}.".format(str(input_path), + error_message)) return str(output_path)