Skip to content

Commit

Permalink
[WASI-NN] Fix llama log print
Browse files Browse the repository at this point in the history
Signed-off-by: dm4 <dm4@secondstate.io>
  • Loading branch information
dm4 committed Oct 30, 2023
1 parent 806cf17 commit 5409095
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions plugins/wasi_nn/ggml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ Expect<ErrNo> compute(WasiNNEnvironment &Env, uint32_t ContextId) noexcept {
}

if (CxtRef.EnableLog) {
llama_log_set(nullptr, &CxtRef.EnableLog);
llama_print_timings(GraphRef.LlamaContext);
}

Expand Down
6 changes: 3 additions & 3 deletions plugins/wasi_nn/thirdparty/ggml/llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7693,9 +7693,9 @@ static void llama_log_internal(ggml_log_level level, const char * format, ...) {

static void llama_log_callback_default(ggml_log_level level, const char * text, void * user_data) {
(void) level;
(void) user_data;
if (std::getenv("LLAMA_LOG") != nullptr) {
bool enable_log = static_cast<bool>(user_data);
if (enable_log) {
fputs(text, stderr);
fflush(stderr);
}
fflush(stderr);
}

0 comments on commit 5409095

Please sign in to comment.