mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-02-05 04:50:18 +01:00
whisper : make beam candidate sort more stable (#1943)
All else being otherwise equal, this encourages the beam candidate selection to re-use the same decoder, which slightly reduces the cache size. I wouldn't expect it to make much of a performance difference, but it helps when debug printing the cache and beam. Added as part of understanding #1941.
This commit is contained in:
parent
ce945b50c3
commit
2852e1af55
@ -5357,7 +5357,10 @@ int whisper_full_with_state(
|
|||||||
beam_candidates.begin(),
|
beam_candidates.begin(),
|
||||||
beam_candidates.end(),
|
beam_candidates.end(),
|
||||||
[](const beam_candidate & a, const beam_candidate & b) {
|
[](const beam_candidate & a, const beam_candidate & b) {
|
||||||
return a.sequence.sum_logprobs_all > b.sequence.sum_logprobs_all;
|
if (a.sequence.sum_logprobs_all != b.sequence.sum_logprobs_all) {
|
||||||
|
return a.sequence.sum_logprobs_all > b.sequence.sum_logprobs_all;
|
||||||
|
}
|
||||||
|
return a.decoder_idx < b.decoder_idx;
|
||||||
});
|
});
|
||||||
|
|
||||||
uint32_t cur_c = 0;
|
uint32_t cur_c = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user