GoogleCloudPlatform / localllm

Apache License 2.0
1.51k stars 113 forks source link

Capture (stderr) logs from llama-cpp-python cleanly #20

Open bobcatfish opened 7 months ago

bobcatfish commented 7 months ago

When we start the process running llama-cpp-python, we provide a pipe for stderr and then promptly close it. This means if llama-cpp-python tries to write to stderr, a broken pipe exception is thrown, which for example happens if there is a prefix cache hit when processing a prompt.

19 is a quick fix for this but it's a bit icky b/c we're still breaking stderr.

What we need to do here is:

  1. not provide a broken pipe for stderr
  2. actually capture logs from llama-cpp-python so they end up in the same place as the logs from uvicorn (added in #18)

Some ideas for how to do this: