File tree Expand file tree Collapse file tree 4 files changed +6
-19
lines changed
examples/whisper.swiftui/whisper.cpp.swift Expand file tree Collapse file tree 4 files changed +6
-19
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ actor WhisperContext {
119119 whisper_print_timings ( context)
120120
121121 let system_info = self . system_info ( )
122- let timings : whisper_timings = whisper_get_timings ( context)
122+ let timings : whisper_timings = whisper_get_timings ( context) . pointee
123123 let encode_ms = String ( format: " %.2f " , timings. encode_ms)
124124 let decode_ms = String ( format: " %.2f " , timings. decode_ms)
125125 let batchd_ms = String ( format: " %.2f " , timings. batchd_ms)
Original file line number Diff line number Diff line change @@ -430,7 +430,7 @@ extern "C" {
430430 float batchd_ms ;
431431 float prompt_ms ;
432432 };
433- WHISPER_API struct whisper_timings whisper_get_timings (struct whisper_context * ctx );
433+ WHISPER_API struct whisper_timings * whisper_get_timings (struct whisper_context * ctx );
434434 WHISPER_API void whisper_print_timings (struct whisper_context * ctx );
435435 WHISPER_API void whisper_reset_timings (struct whisper_context * ctx );
436436
Original file line number Diff line number Diff line change 2424 fattn=" -fa"
2525fi
2626
27- models=( \
28- " tiny" " tiny-q4_0" " tiny-q4_1" " tiny-q5_0" " tiny-q5_1" " tiny-q8_0" \
29- " base" " base-q4_0" " base-q4_1" " base-q5_0" " base-q5_1" " base-q8_0" \
30- " small" " small-q4_0" " small-q4_1" " small-q5_0" " small-q5_1" " small-q8_0" \
31- " medium" " medium-q4_0" " medium-q4_1" " medium-q5_0" " medium-q5_1" " medium-q8_0" " medium-dis" \
32- " large-v2" " large-v2-q4_0" " large-v2-q4_1" " large-v2-q5_0" " large-v2-q5_1" " large-v2-q8_0" " large-v2-dis" \
33- " large-v3-turbo" " large-v3-turbo-q5_0" " large-v3-turbo-q8_0" \
34- )
27+ models=(" tiny" )
3528
3629if [ " $encoder_only " -eq 0 ]; then
3730 printf " \n"
Original file line number Diff line number Diff line change @@ -4186,22 +4186,16 @@ whisper_token whisper_token_transcribe(struct whisper_context * ctx) {
41864186 return ctx->vocab .token_transcribe ;
41874187}
41884188
4189- struct whisper_timings whisper_get_timings (struct whisper_context * ctx) {
4189+ struct whisper_timings * whisper_get_timings (struct whisper_context * ctx) {
41904190 if (ctx->state == nullptr ) {
4191- return whisper_timings {
4192- .sample_ms = 0 ,
4193- .encode_ms = 0 ,
4194- .decode_ms = 0 ,
4195- .batchd_ms = 0 ,
4196- .prompt_ms = 0 ,
4197- };
4191+ return nullptr ;
41984192 }
41994193 const int32_t n_sample = std::max (1 , ctx->state ->n_sample );
42004194 const int32_t n_encode = std::max (1 , ctx->state ->n_encode );
42014195 const int32_t n_decode = std::max (1 , ctx->state ->n_decode );
42024196 const int32_t n_batchd = std::max (1 , ctx->state ->n_batchd );
42034197 const int32_t n_prompt = std::max (1 , ctx->state ->n_prompt );
4204- return whisper_timings {
4198+ return new whisper_timings {
42054199 .sample_ms = 1e-3f * ctx->state ->t_sample_us / n_sample,
42064200 .encode_ms = 1e-3f * ctx->state ->t_encode_us / n_encode,
42074201 .decode_ms = 1e-3f * ctx->state ->t_decode_us / n_decode,
You can’t perform that action at this time.
0 commit comments