Skip to content

Commit

Permalink
llama-cli made a change
Browse files Browse the repository at this point in the history
Now instead of --log-disable we need to redirect stderr to /dev/null:

ggerganov/llama.cpp#9418

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
  • Loading branch information
ericcurtin committed Sep 25, 2024
1 parent ab488f1 commit 4210a6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 6 additions & 1 deletion ramalama/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions ramalama/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def run(self, args):
"llama-cli",
"-m",
symlink_path,
"--log-disable",
"--in-prefix",
"",
"--in-suffix",
Expand All @@ -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)
Expand Down

0 comments on commit 4210a6d

Please sign in to comment.