mirror of https://github.com/google/gemma.cpp.git
Add min_verbosity to MaybePrint
PiperOrigin-RevId: 886094998
This commit is contained in:
parent
1a5226e5de
commit
ceb70203f0
|
|
@ -122,7 +122,7 @@ QueryResultAndMetrics GemmaEnv::BatchQueryModelWithMetrics(
|
|||
return true;
|
||||
};
|
||||
runtime_config_.batch_stream_token = batch_stream_token;
|
||||
MaybePrint(runtime_config_.verbosity,
|
||||
MaybePrint(2, runtime_config_.verbosity,
|
||||
"Max gen: %zu temp: %f tbatch: %zu qbatch: %zu\n",
|
||||
runtime_config_.max_generated_tokens, runtime_config_.temperature,
|
||||
runtime_config_.prefill_tbatch_size,
|
||||
|
|
|
|||
|
|
@ -601,7 +601,7 @@ static void GenerateT(const ModelConfig& config,
|
|||
SetWeightStats(layer, activations, env.ctx);
|
||||
}
|
||||
|
||||
MaybePrint(timing_info.verbosity, "[ BEGIN PHASE: prefill ]");
|
||||
MaybePrint(2, timing_info.verbosity, "[ BEGIN PHASE: prefill ]");
|
||||
const size_t max_gen_steps = PrefillTBatchOrQBatch(
|
||||
config, runtime_config, weights, activations, qbatch, env, timing_info);
|
||||
// No-op if the profiler is disabled, but useful to separate prefill and
|
||||
|
|
@ -622,7 +622,7 @@ static void GenerateT(const ModelConfig& config,
|
|||
const SampleFunc sample_token =
|
||||
ChooseSampleFunc(runtime_config, engine, env.ctx);
|
||||
|
||||
MaybePrint(timing_info.verbosity, "\n[ BEGIN PHASE: generate ]\n");
|
||||
MaybePrint(2, timing_info.verbosity, "\n[ BEGIN PHASE: generate ]\n");
|
||||
|
||||
timing_info.generate_start = hwy::platform::Now();
|
||||
for (size_t gen = 0; gen < max_gen_steps && non_eos.Any(); ++gen) {
|
||||
|
|
@ -736,7 +736,7 @@ void GenerateImageTokensT(const ModelConfig& config,
|
|||
const ModelConfig vit_config = GetVitConfig(config);
|
||||
const size_t num_tokens = vit_config.max_seq_len;
|
||||
|
||||
MaybePrint(timing_info.verbosity, "\n[ BEGIN PHASE: image_token_gen ]\n");
|
||||
MaybePrint(2, timing_info.verbosity, "\n[ BEGIN PHASE: image_token_gen ]\n");
|
||||
timing_info.NotifyImageTokenStart();
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@
|
|||
|
||||
namespace gcpp {
|
||||
|
||||
void MaybePrint(int verbosity, const char* format, ...) {
|
||||
void MaybePrint(int min_verbosity, int verbosity, const char* format, ...) {
|
||||
if (verbosity < min_verbosity) return;
|
||||
char buf[800];
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ static inline intptr_t MaybeTestInitialized(const void* ptr, size_t size) {
|
|||
#endif
|
||||
}
|
||||
|
||||
// If verbosity >= 2, prints the formatted message to stderr.
|
||||
void MaybePrint(int verbosity, const char* format, ...);
|
||||
// If `verbosity >= min_verbosity`, prints the formatted message to stderr.
|
||||
void MaybePrint(int min_verbosity, int verbosity, const char* format, ...);
|
||||
|
||||
// Shared between gemma.h and ops-inl.h.
|
||||
#pragma pack(push, 1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue