ref #52 : improve greedy sampling strategy

Force timestamp token to be sampled if the probability sum over all
timestamp tokens is above the probability of any other token
This commit is contained in:
Georgi Gerganov
2022-10-18 19:33:10 +03:00
parent 632660abb9
commit 7eeef0358a
2 changed files with 26 additions and 15 deletions

View File

@@ -120,7 +120,7 @@ extern "C" {
// You can also implement your own sampling method using the whisper_get_probs() function.
// whisper_sample_best() returns the token with the highest probability
// whisper_sample_timestamp() returns the most probable timestamp token
WHISPER_API whisper_token whisper_sample_best(struct whisper_context * ctx, bool need_timestamp);
WHISPER_API whisper_token whisper_sample_best(struct whisper_context * ctx);
WHISPER_API whisper_token whisper_sample_timestamp(struct whisper_context * ctx);
// Return the id of the specified language, returns -1 if not found