diff options
author | David Renshaw <dwrenshaw@gmail.com> | 2024-04-14 15:24:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-14 15:24:15 -0400 |
commit | 1958f7e06ca2d2e3ab5698cc67513ba359144d8e (patch) | |
tree | 37ec66188f799725e9378cbf572a0bd8dc30e858 | |
parent | 04fbc5f23e9708136ff03ebe194c7a7e965a7ca4 (diff) |
llama : add missing kv clear in llama_beam_search (#6664)
-rw-r--r-- | llama.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -13063,6 +13063,11 @@ struct llama_beam_search_data { } llama_logit_info logit_info(ctx); std::vector<llama_token_data> next_tokens = logit_info.top_k(n_beams); + + // Clear the kv slot so that other beams may try different tokens at this position. The llama_decode() + // call in loop() will conclusively fill in the kv slot once the beams converge at this position. + llama_kv_cache_seq_rm(ctx, 0, n_past, -1); + size_t i=0; if (next_beams.size() < n_beams) { for (; next_beams.size() < n_beams ; ++i) { |