Skip to content

Commit abf2410

Browse files
authored
main : honor --verbose-prompt on interactive prompts (#14350)
1 parent 901e20b commit abf2410

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tools/main/main.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,10 +917,19 @@ int main(int argc, char ** argv) {
917917
embd_inp.insert(embd_inp.end(), line_inp.begin(), line_inp.end());
918918
embd_inp.insert(embd_inp.end(), line_sfx.begin(), line_sfx.end());
919919

920+
if (params.verbose_prompt) {
921+
LOG_INF("%s: number of tokens in prompt = %zu\n", __func__, embd_inp.size() - original_size);
922+
}
923+
920924
for (size_t i = original_size; i < embd_inp.size(); ++i) {
921925
const llama_token token = embd_inp[i];
926+
const std::string token_str = common_token_to_piece(ctx, token);
922927
output_tokens.push_back(token);
923-
output_ss << common_token_to_piece(ctx, token);
928+
output_ss << token_str;
929+
930+
if (params.verbose_prompt) {
931+
LOG_INF("%6d -> '%s'\n", token, token_str.c_str());
932+
}
924933
}
925934

926935
// reset assistant message

0 commit comments

Comments
 (0)