@@ -13,8 +13,6 @@ static std::vector<std::vector<float>> encode(llama_context * ctx, const std::ve
1313 const llama_model * model = llama_get_model (ctx);
1414 const llama_vocab * vocab = llama_model_get_vocab (model);
1515
16- llama_kv_cache * kv = llama_get_kv_cache (ctx);
17-
1816 llama_batch batch = llama_batch_init (llama_n_batch (ctx), 0 , 1 );
1917
2018 for (uint64_t i = 0 ; i < sentences.size (); i++) {
@@ -47,7 +45,7 @@ static std::vector<std::vector<float>> encode(llama_context * ctx, const std::ve
4745 }
4846
4947 // clear previous kv_cache values (irrelevant for embeddings)
50- llama_kv_cache_clear (kv );
48+ llama_kv_self_clear (ctx );
5149 llama_set_embeddings (ctx, true );
5250 llama_set_causal_attn (ctx, false );
5351
@@ -102,11 +100,9 @@ static std::string generate(llama_context * ctx, llama_sampler * smpl, const std
102100 const llama_model * model = llama_get_model (ctx);
103101 const llama_vocab * vocab = llama_model_get_vocab (model);
104102
105- llama_kv_cache * kv = llama_get_kv_cache (ctx);
106-
107103 llama_token eos_token = llama_vocab_eos (vocab);
108104
109- llama_kv_cache_clear (kv );
105+ llama_kv_self_clear (ctx );
110106 llama_set_embeddings (ctx, false );
111107 llama_set_causal_attn (ctx, true );
112108
0 commit comments