-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Add logging hooks to mtmd to allow redirection to appropriate log message sinks #17261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ngxson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need a whole callback system. Unless you have specific need, just a simple mtmd_helper_set_log_level(ggml_log_level) should do the trick
| #include <stddef.h> | ||
| #include <stdint.h> | ||
| #include <stdio.h> | ||
| #include <stdarg.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this is needed?
| } | ||
| static mtmd_log_callback_t log_callback = log_callback_default; | ||
|
|
||
| void mtmd_set_log_callback(mtmd_log_callback_t callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| void mtmd_set_log_callback(mtmd_log_callback_t callback) { | |
| void mtmd_helper_set_log_callback(mtmd_helper_log_callback_t callback) { |
| int32_t n_batch, | ||
| llama_pos * new_n_past); | ||
|
|
||
| typedef void (*mtmd_log_callback_t)(enum ggml_log_level level, const char * fmt, ...); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, prefix everything with mtmd_helper
|
On second thought, it will be cleaner to implement the same pattern in LLAMA_API void llama_log_set(ggml_log_callback log_callback, void * user_data);Reusing |
|
Superseded by #17268 |
Make sure to read the contributing guidelines before submitting a PR
Add logging hooks to mtmd so that the log messages from the library can be redirected to appropriate log message sinks as needed by the clients.
The main underlying issue is that log messages from mtmd are blindly emitted to stdout which pollute the stdout from llama-mtmd-cli as just a stream of model output.
Rework of an earlier PullRequest #17223 that was rejected because mtmd cannot take a dependency on libcommon which allow for log messages