formatting: break overly long LOG lines

This commit is contained in:
staviq 2023-09-17 14:45:25 +02:00
parent 28cdd8c3b0
commit 06e5c1902a
2 changed files with 44 additions and 14 deletions

View file

@ -298,8 +298,11 @@ int main(int argc, char ** argv) {
} else if (n_matching_session_tokens >= embd_inp.size()) {
LOG_TEE("%s: session file has exact match for prompt!\n", __func__);
} else if (n_matching_session_tokens < (embd_inp.size() / 2)) {
LOG_TEE("%s: warning: session file has low similarity to prompt (%zu / %zu tokens); will mostly be reevaluated\n",
__func__, n_matching_session_tokens, embd_inp.size());
LOG_TEE(
"%s: warning: session file has low similarity to prompt (%zu / %zu tokens);"
" will mostly be reevaluated\n",
__func__, n_matching_session_tokens, embd_inp.size()
);
} else {
LOG_TEE("%s: session file matches %zu / %zu tokens of prompt\n",
__func__, n_matching_session_tokens, embd_inp.size());
@ -307,8 +310,10 @@ int main(int argc, char ** argv) {
}
LOGLN(
"recalculate the cached logits (check): embd_inp.empty() %s, n_matching_session_tokens %zu, embd_inp.size() %zu, session_tokens.size() %zu, embd_inp.size() %zu",
log_tostr(embd_inp.empty()), n_matching_session_tokens, embd_inp.size(), session_tokens.size(), embd_inp.size());
"recalculate the cached logits (check): embd_inp.empty() %s, n_matching_session_tokens %zu,"
" embd_inp.size() %zu, session_tokens.size() %zu, embd_inp.size() %zu",
log_tostr(embd_inp.empty()), n_matching_session_tokens, embd_inp.size(), session_tokens.size(), embd_inp.size()
);
// if we will use the cache for the full prompt without reaching the end of the cache, force
// reevaluation of the last token token to recalculate the cached logits
@ -402,9 +407,17 @@ int main(int argc, char ** argv) {
LOG_TEE("Input suffix: '%s'\n", params.input_suffix.c_str());
}
}
LOG_TEE("sampling: repeat_last_n = %d, repeat_penalty = %f, presence_penalty = %f, frequency_penalty = %f, top_k = %d, tfs_z = %f, top_p = %f, typical_p = %f, temp = %f, mirostat = %d, mirostat_lr = %f, mirostat_ent = %f\n",
params.repeat_last_n, params.repeat_penalty, params.presence_penalty, params.frequency_penalty, params.top_k, params.tfs_z, params.top_p, params.typical_p, params.temp, params.mirostat, params.mirostat_eta, params.mirostat_tau);
LOG_TEE("generate: n_ctx = %d, n_batch = %d, n_predict = %d, n_keep = %d\n", n_ctx, params.n_batch, params.n_predict, params.n_keep);
LOG_TEE(
"sampling: repeat_last_n = %d, repeat_penalty = %f, presence_penalty = %f,"
" frequency_penalty = %f, top_k = %d, tfs_z = %f, top_p = %f, typical_p = %f,"
" temp = %f, mirostat = %d, mirostat_lr = %f, mirostat_ent = %f\n",
params.repeat_last_n, params.repeat_penalty, params.presence_penalty,
params.frequency_penalty, params.top_k, params.tfs_z, params.top_p, params.typical_p,
params.temp, params.mirostat, params.mirostat_eta, params.mirostat_tau
);
LOG_TEE(
"generate: n_ctx = %d, n_batch = %d, n_predict = %d, n_keep = %d\n",
n_ctx, params.n_batch, params.n_predict, params.n_keep);
LOG_TEE("\n\n");
struct llama_grammar * grammar = NULL;
@ -509,7 +522,10 @@ int main(int argc, char ** argv) {
}
const int n_left = n_past - params.n_keep;
LOG("context full, swapping: n_past = %d, n_left = %d, n_ctx = %d, n_keep = %d\n", n_past, n_left, n_ctx, params.n_keep);
LOG(
"context full, swapping: n_past = %d, n_left = %d, n_ctx = %d, n_keep = %d\n",
n_past, n_left, n_ctx, params.n_keep
);
// always keep the first token - BOS
n_past = std::max(1, params.n_keep);

View file

@ -154,7 +154,10 @@ int main(int argc, char ** argv) {
// check if the draft matches the target
if (i_dft < (int) drafted.size() && id == drafted[i_dft]) {
LOG("the sampled target token matches the %dth drafted token (%d, '%s') - accepted\n", i_dft, id, token_str.c_str());
LOG(
"the sampled target token matches the %dth drafted token (%d, '%s') - accepted\n",
i_dft, id, token_str.c_str()
);
++n_accept;
++n_past_tgt;
++n_past_dft;
@ -166,8 +169,10 @@ int main(int argc, char ** argv) {
// the drafted token was rejected or we are out of drafted tokens
if (i_dft < (int) drafted.size()) {
LOG("the %dth drafted token (%d, '%s') does not match the sampled target token (%d, '%s') - rejected\n",
i_dft, drafted[i_dft], llama_token_to_piece(ctx_dft, drafted[i_dft]).c_str(), id, token_str.c_str());
LOG(
"the %dth drafted token (%d, '%s') does not match the sampled target token (%d, '%s') - rejected\n",
i_dft, drafted[i_dft], llama_token_to_piece(ctx_dft, drafted[i_dft]).c_str(), id, token_str.c_str()
);
} else {
LOG("out of drafted tokens\n");
}
@ -235,7 +240,10 @@ int main(int argc, char ** argv) {
llama_sample_softmax(ctx_dft, &cur_p);
for (int i = 0; i < 3; ++i) {
LOG(" - draft candidate %3d: %6d (%8.3f) '%s'\n", i, cur_p.data[i].id, cur_p.data[i].p, llama_token_to_piece(ctx_dft, cur_p.data[i].id).c_str());
LOG(
" - draft candidate %3d: %6d (%8.3f) '%s'\n",
i, cur_p.data[i].id, cur_p.data[i].p, llama_token_to_piece(ctx_dft, cur_p.data[i].id).c_str()
);
}
// TODO: better logic?
@ -276,8 +284,14 @@ int main(int argc, char ** argv) {
LOG_TEE("\n\n");
LOG_TEE("encoded %4d tokens in %8.3f seconds, speed: %8.3f t/s\n", n_input, (t_enc_end - t_enc_start) / 1e6f, inp.size() / ((t_enc_end - t_enc_start) / 1e6f));
LOG_TEE("decoded %4d tokens in %8.3f seconds, speed: %8.3f t/s\n", n_predict, (t_dec_end - t_dec_start) / 1e6f, n_predict / ((t_dec_end - t_dec_start) / 1e6f));
LOG_TEE(
"encoded %4d tokens in %8.3f seconds, speed: %8.3f t/s\n",
n_input, (t_enc_end - t_enc_start) / 1e6f, inp.size() / ((t_enc_end - t_enc_start) / 1e6f)
);
LOG_TEE(
"decoded %4d tokens in %8.3f seconds, speed: %8.3f t/s\n",
n_predict, (t_dec_end - t_dec_start) / 1e6f, n_predict / ((t_dec_end - t_dec_start) / 1e6f)
);
// TODO: make sure these numbers are computed correctly
LOG_TEE("\n");