Skip to content
Merged
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
9 changes: 5 additions & 4 deletions extension/llm/runner/text_llm_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ Error TextLLMRunner::generate(
stats_->first_token_ms = time_in_ms();
stats_->prompt_eval_end_ms = time_in_ms();

RUNNER_ET_LOG(
config.warming,
"RSS after prompt prefill: %f MiB (0 if unsupported)",
get_rss_bytes() / 1024.0 / 1024.0);

// print the first token from prefill. No prev_token so use cur_token for it.
auto decode_result = tokenizer_->decode(cur_token, cur_token);
if (!decode_result.ok()) {
Expand All @@ -179,10 +184,6 @@ Error TextLLMRunner::generate(
return ::executorch::runtime::Error::InvalidArgument;
}
wrapped_callback(std::move(*decode_result));
RUNNER_ET_LOG(
config.warming,
"RSS after prompt prefill: %f MiB (0 if unsupported)",
get_rss_bytes() / 1024.0 / 1024.0);

// start the main loop
prompt_tokens.push_back(cur_token);
Expand Down
6 changes: 5 additions & 1 deletion extension/llm/runner/text_token_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,13 @@ class ET_EXPERIMENTAL TextTokenGenerator {
if (eos_ids_->find(cur_token) != eos_ids_->end()) {
printf("\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not your change but weird we have a printf

ET_LOG(Info, "\nReached to the end of generation");
break;
return pos - start_pos;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you put this in a variable and share it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh its in the loop. Nvm I guess

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving as-is, because one is inside a while loop and another is not.

}
}
ET_LOG(
Info,
"\nFinished generation. Generated %" PRIi32 " tokens.",
start_pos + max_new_tokens);
return pos - start_pos;
}

Expand Down
Loading