sandrohanea Sandro Hanea commited on
Commit
2b4a95c
·
unverified ·
1 Parent(s): d717a20

whisper : fix with_state methods to use the correct state (#1519)

Browse files
Files changed (1) hide show
  1. whisper.cpp +2 -2
whisper.cpp CHANGED
@@ -3525,7 +3525,7 @@ int whisper_encode(struct whisper_context * ctx, int offset, int n_threads) {
3525
  int whisper_decode_with_state(struct whisper_context * ctx, struct whisper_state * state, const whisper_token * tokens, int n_tokens, int n_past, int n_threads) {
3526
  whisper_batch_prep_legacy(state->batch, tokens, n_tokens, n_past, 0);
3527
 
3528
- whisper_kv_cache_seq_rm(ctx->state->kv_self, 0, n_past, -1);
3529
 
3530
  if (!whisper_decode_internal(*ctx, *state, state->batch, n_threads, nullptr, nullptr)) {
3531
  WHISPER_LOG_ERROR("%s: failed to eval\n", __func__);
@@ -5186,7 +5186,7 @@ int whisper_full_with_state(
5186
  const int progress_cur = (100*(seek - seek_start))/(seek_end - seek_start);
5187
 
5188
  params.progress_callback(
5189
- ctx, ctx->state, progress_cur, params.progress_callback_user_data);
5190
  }
5191
 
5192
  // of only 1 second left, then stop
 
3525
  int whisper_decode_with_state(struct whisper_context * ctx, struct whisper_state * state, const whisper_token * tokens, int n_tokens, int n_past, int n_threads) {
3526
  whisper_batch_prep_legacy(state->batch, tokens, n_tokens, n_past, 0);
3527
 
3528
+ whisper_kv_cache_seq_rm(state->kv_self, 0, n_past, -1);
3529
 
3530
  if (!whisper_decode_internal(*ctx, *state, state->batch, n_threads, nullptr, nullptr)) {
3531
  WHISPER_LOG_ERROR("%s: failed to eval\n", __func__);
 
5186
  const int progress_cur = (100*(seek - seek_start))/(seek_end - seek_start);
5187
 
5188
  params.progress_callback(
5189
+ ctx, state, progress_cur, params.progress_callback_user_data);
5190
  }
5191
 
5192
  // of only 1 second left, then stop