File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -18425,13 +18425,13 @@ static void llama_kv_cache_defrag_internal(struct llama_context & lctx) {
1842518425static void llama_kv_cache_update_internal(struct llama_context & lctx) {
1842618426 bool need_reserve = false;
1842718427
18428- // apply K-shift if needed
18429- if (lctx.model.hparams.rope_type != LLAMA_ROPE_TYPE_NONE && lctx.kv_self.has_shift) {
18428+ if (lctx.kv_self.has_shift) {
1843018429 if (!llama_kv_cache_can_shift(&lctx)) {
18431- GGML_ABORT("Deepseek2 does not support K-shift");
18430+ GGML_ABORT("The current context does not support K-shift");
1843218431 }
1843318432
18434- {
18433+ // apply K-shift if needed
18434+ if (lctx.model.hparams.rope_type != LLAMA_ROPE_TYPE_NONE) {
1843518435 ggml_backend_sched_reset(lctx.sched.get());
1843618436
1843718437 ggml_cgraph * gf = llama_build_graph_k_shift(lctx);
@@ -20682,7 +20682,7 @@ void llama_kv_cache_update(struct llama_context * ctx) {
2068220682}
2068320683
2068420684bool llama_kv_cache_can_shift(struct llama_context * ctx) {
20685- return ctx->model.arch != LLM_ARCH_DEEPSEEK2; // not supported due to MLA
20685+ return !ctx->kv_self.recurrent && ctx->model.arch != LLM_ARCH_DEEPSEEK2; // not supported due to MLA
2068620686}
2068720687
2068820688// deprecated
You can’t perform that action at this time.
0 commit comments