llama : fix rotation of attention tensors in layers with shared KV (#31406)

* llama : fix rotation of layers that reuse another layer's KV cache

* llama : use KV source rotation only for attn_* tensors
This commit is contained in:
Niklas Wenzel authored and GitHub committed 2026-10-31 23:30:49 +01:00
1 parent ddf48f85c9
commit 0138937e3f
5 files changed
+23 -27

No files matched your search

+1 -14
View File
@@ -319,20 +319,7 @@ uint32_t llama_hparams::n_embd_head_v_mla() const {
}
bool llama_hparams::has_kv(uint32_t il) const {
if (kv_source(il) != il) {
return false;
}
if (n_layer_kv_from_start >= 0) {
if (il < (uint32_t) n_layer_kv_from_start) {
return true;
}
return false;
}
// by default, all layers have kv
return true;
return kv_source(il) == il;
}
uint32_t llama_hparams::kv_source(uint32_t il) const {