llama : remove implicit recurrent state rollbacks

This commit is contained in:
Francis Couture-Harpin
2024-11-24 20:35:30 -05:00
parent 124c222f76
commit 8006f3b3c8
25 changed files with 411 additions and 1119 deletions

View File

@@ -209,7 +209,7 @@ actor LlamaContext {
}
batch.logits[Int(batch.n_tokens) - 1] = 1 // true
llama_past_clear(context)
llama_kv_cache_clear(context)
let t_pp_start = ggml_time_us()
@@ -222,7 +222,7 @@ actor LlamaContext {
// bench text generation
llama_past_clear(context)
llama_kv_cache_clear(context)
let t_tg_start = ggml_time_us()
@@ -241,7 +241,7 @@ actor LlamaContext {
let t_tg_end = ggml_time_us()
llama_past_clear(context)
llama_kv_cache_clear(context)
let t_pp = Double(t_pp_end - t_pp_start) / 1000000.0
let t_tg = Double(t_tg_end - t_tg_start) / 1000000.0
@@ -291,7 +291,7 @@ actor LlamaContext {
func clear() {
tokens_list.removeAll()
temporary_invalid_cchars.removeAll()
llama_past_clear(context)
llama_kv_cache_clear(context)
}
private func tokenize(text: String, add_bos: Bool) -> [llama_token] {