Skip to content
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

add verbosity -1 to log token, so can output only tokens with -lv -1 #10744

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1940,7 +1940,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
));
add_opt(common_arg(
{"-lv", "--verbosity", "--log-verbosity"}, "N",
"Set the verbosity threshold. Messages with a higher verbosity will be ignored.",
"Set the verbosity threshold. Messages with a higher verbosity will be ignored. (-lv -1 for token only, no EOS nor EOG message)",
[](common_params & params, int value) {
params.verbosity = value;
common_log_set_verbosity_thold(value);
Expand Down
1 change: 1 addition & 0 deletions common/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void common_log_set_timestamps(struct common_log * log, bool timestamps)
} \
} while (0)

#define LOGTOKEN(...) LOG_TMPL(GGML_LOG_LEVEL_NONE, -1, __VA_ARGS__)
#define LOG(...) LOG_TMPL(GGML_LOG_LEVEL_NONE, 0, __VA_ARGS__)
#define LOGV(verbosity, ...) LOG_TMPL(GGML_LOG_LEVEL_NONE, verbosity, __VA_ARGS__)

Expand Down
2 changes: 1 addition & 1 deletion examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ int main(int argc, char ** argv) {
const std::string token_str = common_token_to_piece(ctx, id, params.special);

// Console/Stream Output
LOG("%s", token_str.c_str());
LOGTOKEN("%s", token_str.c_str());

// Record Displayed Tokens To Log
// Note: Generated tokens are created one by one hence this check
Expand Down
Loading