Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset ctx->t_start_us when calling whisper_reset_timings() #1434

Conversation

bjnortier
Copy link
Contributor

Currently ctx->t_start_us is not reset when calling whisper_reset_timings(). This leads to an incorrect "total time" when doing consecutive transcription calls. In the SwiftUI example app it also outputs the total time from app startup (which loads the model) to when the transcription finishes.

See below for example log outputs

@bjnortier
Copy link
Contributor Author

Before. "total time" is time from initial app startup to finish of first transcription. Subsequent transcriptions show total time from app startup.

Selecting 8 threads
About to run whisper_full
[00:00:00.000 --> 00:00:07.300]   And so my fellow Americans ask not what your country can do for you
[00:00:07.300 --> 00:00:12.400]   ask what you can do for your country.

whisper_print_timings:     load time =    47.99 ms
whisper_print_timings:     fallbacks =   0 p /   0 h
whisper_print_timings:      mel time =     6.67 ms
whisper_print_timings:   sample time =    11.16 ms /    27 runs (    0.41 ms per run)
whisper_print_timings:   encode time =   383.20 ms /     1 runs (  383.20 ms per run)
whisper_print_timings:   decode time =    29.17 ms /    27 runs (    1.08 ms per run)
whisper_print_timings:   prompt time =     0.00 ms /     1 runs (    0.00 ms per run)
whisper_print_timings:    total time =  1797.31 ms

Selecting 8 threads
About to run whisper_full
[00:00:00.000 --> 00:00:07.300]   And so my fellow Americans ask not what your country can do for you
[00:00:07.300 --> 00:00:12.400]   ask what you can do for your country.

whisper_print_timings:     load time =    47.99 ms
whisper_print_timings:     fallbacks =   0 p /   0 h
whisper_print_timings:      mel time =    16.72 ms
whisper_print_timings:   sample time =    11.08 ms /    27 runs (    0.41 ms per run)
whisper_print_timings:   encode time =   385.28 ms /     1 runs (  385.28 ms per run)
whisper_print_timings:   decode time =    40.26 ms /    27 runs (    1.49 ms per run)
whisper_print_timings:   prompt time =     0.00 ms /     1 runs (    0.00 ms per run)
whisper_print_timings:    total time =  7639.08 ms

Selecting 8 threads
About to run whisper_full
[00:00:00.000 --> 00:00:07.300]   And so my fellow Americans ask not what your country can do for you
[00:00:07.300 --> 00:00:12.400]   ask what you can do for your country.

whisper_print_timings:     load time =    47.99 ms
whisper_print_timings:     fallbacks =   0 p /   0 h
whisper_print_timings:      mel time =    27.72 ms
whisper_print_timings:   sample time =    11.13 ms /    27 runs (    0.41 ms per run)
whisper_print_timings:   encode time =   385.56 ms /     1 runs (  385.56 ms per run)
whisper_print_timings:   decode time =    36.23 ms /    27 runs (    1.34 ms per run)
whisper_print_timings:   prompt time =     0.00 ms /     1 runs (    0.00 ms per run)
whisper_print_timings:    total time = 11275.45 ms

@bjnortier
Copy link
Contributor Author

After. "total time" shows transcription time

Selecting 8 threads
About to run whisper_full
[00:00:00.000 --> 00:00:07.300]   And so my fellow Americans ask not what your country can do for you
[00:00:07.300 --> 00:00:12.400]   ask what you can do for your country.

whisper_print_timings:     load time =    55.53 ms
whisper_print_timings:     fallbacks =   0 p /   0 h
whisper_print_timings:      mel time =     7.42 ms
whisper_print_timings:   sample time =    11.24 ms /    27 runs (    0.42 ms per run)
whisper_print_timings:   encode time =   415.34 ms /     1 runs (  415.34 ms per run)
whisper_print_timings:   decode time =    50.04 ms /    27 runs (    1.85 ms per run)
whisper_print_timings:   prompt time =     0.00 ms /     1 runs (    0.00 ms per run)
whisper_print_timings:    total time =   484.90 ms

Selecting 8 threads
About to run whisper_full
[00:00:00.000 --> 00:00:07.300]   And so my fellow Americans ask not what your country can do for you
[00:00:07.300 --> 00:00:12.400]   ask what you can do for your country.

whisper_print_timings:     load time =    55.53 ms
whisper_print_timings:     fallbacks =   0 p /   0 h
whisper_print_timings:      mel time =    18.01 ms
whisper_print_timings:   sample time =    11.34 ms /    27 runs (    0.42 ms per run)
whisper_print_timings:   encode time =   396.28 ms /     1 runs (  396.28 ms per run)
whisper_print_timings:   decode time =    35.22 ms /    27 runs (    1.30 ms per run)
whisper_print_timings:   prompt time =     0.00 ms /     1 runs (    0.00 ms per run)
whisper_print_timings:    total time =   453.65 ms

Selecting 8 threads
About to run whisper_full
[00:00:00.000 --> 00:00:07.300]   And so my fellow Americans ask not what your country can do for you
[00:00:07.300 --> 00:00:12.400]   ask what you can do for your country.

whisper_print_timings:     load time =    55.53 ms
whisper_print_timings:     fallbacks =   0 p /   0 h
whisper_print_timings:      mel time =    28.65 ms
whisper_print_timings:   sample time =    11.17 ms /    27 runs (    0.41 ms per run)
whisper_print_timings:   encode time =   400.93 ms /     1 runs (  400.93 ms per run)
whisper_print_timings:   decode time =    38.94 ms /    27 runs (    1.44 ms per run)
whisper_print_timings:   prompt time =     0.00 ms /     1 runs (    0.00 ms per run)
whisper_print_timings:    total time =   461.91 ms

@ggerganov ggerganov merged commit 11b5030 into ggerganov:master Nov 7, 2023
35 checks passed
vonstring pushed a commit to vonstring/whisper.cpp that referenced this pull request Nov 7, 2023
@bjnortier bjnortier deleted the reset_print_timings_for_repeated_transcriptions branch November 8, 2023 15:37
felrock pushed a commit to felrock/whisper.cpp that referenced this pull request Nov 18, 2023
landtanin pushed a commit to landtanin/whisper.cpp that referenced this pull request Dec 16, 2023
iThalay pushed a commit to iThalay/whisper.cpp that referenced this pull request Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants