From 4210a6d68bf8db1c270ab94ad1c22b65166b7d72 Mon Sep 17 00:00:00 2001 From: Eric Curtin Date: Wed, 25 Sep 2024 11:36:06 +0100 Subject: [PATCH] llama-cli made a change Now instead of --log-disable we need to redirect stderr to /dev/null: https://github.com/ggerganov/llama.cpp/pull/9418 Signed-off-by: Eric Curtin --- ramalama/common.py | 7 ++++++- ramalama/model.py | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ramalama/common.py b/ramalama/common.py index 2a1985eb..5950b79b 100644 --- a/ramalama/common.py +++ b/ramalama/common.py @@ -34,10 +34,15 @@ def available(cmd): return shutil.which(cmd) is not None -def exec_cmd(args): +def exec_cmd(args, stderr=True): if x: print(*args) + if not stderr: + # Redirecting stderr to /dev/null + with open(os.devnull, 'w') as devnull: + os.dup2(devnull.fileno(), sys.stderr.fileno()) + try: return os.execvp(args[0], args) except Exception: diff --git a/ramalama/model.py b/ramalama/model.py index 5e888051..97a62790 100644 --- a/ramalama/model.py +++ b/ramalama/model.py @@ -86,7 +86,6 @@ def run(self, args): "llama-cli", "-m", symlink_path, - "--log-disable", "--in-prefix", "", "--in-suffix", @@ -98,7 +97,7 @@ def run(self, args): if not args.ARGS: exec_args.append("-cnv") - exec_cmd(exec_args) + exec_cmd(exec_args, False) def serve(self, args): symlink_path = self.pull(args)