@@ -405,6 +405,8 @@ struct whisper_context {
405
405
406
406
std::vector<whisper_result> result_cur;
407
407
std::vector<whisper_segment> result_all;
408
+
409
+ std::vector<whisper_token> prompt_past;
408
410
};
409
411
410
412
// load the model from a ggml file
@@ -1020,8 +1022,6 @@ bool whisper_model_load(const std::string & fname, whisper_context & wctx) {
1020
1022
// - model: the model
1021
1023
// - n_threads: number of threads to use
1022
1024
// - mel_offset: offset in the mel spectrogram (i.e. audio offset)
1023
- // - mel_inp: input mel spectrogram
1024
- // - features: output encoded features
1025
1025
//
1026
1026
bool whisper_encode (
1027
1027
whisper_context & wctx,
@@ -1405,10 +1405,9 @@ bool whisper_encode(
1405
1405
//
1406
1406
// - model: the model
1407
1407
// - n_threads: number of threads to use
1408
- // - n_past: prompt length
1409
- // - prompt: text prompt
1410
- // - logits_out: output logits
1411
- // - probs_out: output probabilities
1408
+ // - tokens: text prompt
1409
+ // - n_tokens: number of tokens in the prompt
1410
+ // - n_past: number of past tokens to prefix the prompt with
1412
1411
//
1413
1412
bool whisper_decode (
1414
1413
whisper_context & wctx,
@@ -2259,6 +2258,7 @@ struct whisper_full_params whisper_full_default_params(enum whisper_decode_strat
2259
2258
.offset_ms = 0 ,
2260
2259
2261
2260
.translate = false ,
2261
+ .no_context = false ,
2262
2262
.print_special_tokens = false ,
2263
2263
.print_progress = true ,
2264
2264
.print_realtime = false ,
@@ -2279,6 +2279,7 @@ struct whisper_full_params whisper_full_default_params(enum whisper_decode_strat
2279
2279
.offset_ms = 0 ,
2280
2280
2281
2281
.translate = false ,
2282
+ .no_context = false ,
2282
2283
.print_special_tokens = false ,
2283
2284
.print_progress = true ,
2284
2285
.print_realtime = false ,
@@ -2297,6 +2298,7 @@ struct whisper_full_params whisper_full_default_params(enum whisper_decode_strat
2297
2298
2298
2299
return result;
2299
2300
}
2301
+
2300
2302
int whisper_full (
2301
2303
struct whisper_context * ctx,
2302
2304
struct whisper_full_params params,
@@ -2309,7 +2311,10 @@ int whisper_full(
2309
2311
}
2310
2312
2311
2313
// the accumulated text context so far
2312
- std::vector<whisper_token> prompt_past = { };
2314
+ auto & prompt_past = ctx->prompt_past ;
2315
+ if (params.no_context ) {
2316
+ prompt_past.clear ();
2317
+ }
2313
2318
2314
2319
// these tokens determine the task that will be performed
2315
2320
std::vector<whisper_token> prompt_init = { whisper_token_sot (ctx) };
0 commit comments