mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-08-12 16:17:29 +02:00
bench : fix timings by running a pre-heat
This commit is contained in:
@ -70,6 +70,15 @@ int whisper_bench_encoder(const whisper_params & params) {
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// heat up
|
||||||
|
if (int ret = whisper_encode(ctx, 0, params.n_threads) != 0) {
|
||||||
|
fprintf(stderr, "error: failed to encode model: %d\n", ret);
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
whisper_reset_timings(ctx);
|
||||||
|
|
||||||
|
// actual run
|
||||||
if (int ret = whisper_encode(ctx, 0, params.n_threads) != 0) {
|
if (int ret = whisper_encode(ctx, 0, params.n_threads) != 0) {
|
||||||
fprintf(stderr, "error: failed to encode model: %d\n", ret);
|
fprintf(stderr, "error: failed to encode model: %d\n", ret);
|
||||||
return 4;
|
return 4;
|
||||||
|
@ -48,9 +48,6 @@ printf "| CPU | OS | Config | Model | Th | Load | Enc. | Commit |\n"
|
|||||||
printf "| --- | -- | ------ | ----- | -- | ---- | ---- | ------ |\n"
|
printf "| --- | -- | ------ | ----- | -- | ---- | ---- | ------ |\n"
|
||||||
|
|
||||||
for model in "${models[@]}"; do
|
for model in "${models[@]}"; do
|
||||||
# run once to heat-up the cache
|
|
||||||
./bench -m ./models/ggml-$model.bin -t $n_threads 2>/dev/null 1>/dev/null
|
|
||||||
|
|
||||||
# actual run
|
# actual run
|
||||||
# store stderr output in a variable in order to parse it later
|
# store stderr output in a variable in order to parse it later
|
||||||
output=$(./bench -m ./models/ggml-$model.bin -t $n_threads 2>&1)
|
output=$(./bench -m ./models/ggml-$model.bin -t $n_threads 2>&1)
|
||||||
|
@ -3588,6 +3588,9 @@ void whisper_reset_timings(struct whisper_context * ctx) {
|
|||||||
ctx->state->t_sample_us = 0;
|
ctx->state->t_sample_us = 0;
|
||||||
ctx->state->t_encode_us = 0;
|
ctx->state->t_encode_us = 0;
|
||||||
ctx->state->t_decode_us = 0;
|
ctx->state->t_decode_us = 0;
|
||||||
|
ctx->state->n_sample = 0;
|
||||||
|
ctx->state->n_encode = 0;
|
||||||
|
ctx->state->n_decode = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user