(
level: int,
text: bytes,
user_data: ctypes.c_void_p,
)
| 29 | # typedef void (*ggml_log_callback)(enum ggml_log_level level, const char * text, void * user_data); |
| 30 | @llama_cpp.llama_log_callback |
| 31 | def llama_log_callback( |
| 32 | level: int, |
| 33 | text: bytes, |
| 34 | user_data: ctypes.c_void_p, |
| 35 | ): |
| 36 | # TODO: Correctly implement continue previous log |
| 37 | global _last_log_level |
| 38 | log_level = ( |
| 39 | GGML_LOG_LEVEL_TO_LOGGING_LEVEL[level] if level != 5 else _last_log_level |
| 40 | ) |
| 41 | if logger.level <= GGML_LOG_LEVEL_TO_LOGGING_LEVEL[level]: |
| 42 | print(text.decode("utf-8"), end="", flush=True, file=sys.stderr) |
| 43 | _last_log_level = log_level |
| 44 | |
| 45 | |
| 46 | llama_cpp.llama_log_set(llama_log_callback, ctypes.c_void_p(0)) |
nothing calls this directly
no test coverage detected
searching dependent graphs…