Explorar o código

llama : disable FA if KV head size do not match (#7982)

Georgi Gerganov hai 1 ano
pai
achega
7c26775adb
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      llama.cpp

+ 5 - 0
llama.cpp

@@ -16260,6 +16260,11 @@ struct llama_context * llama_new_context_with_model(
         params.flash_attn = false;
         params.flash_attn = false;
     }
     }
 
 
+    if (params.flash_attn && model->hparams.n_embd_head_k != model->hparams.n_embd_head_v) {
+        LLAMA_LOG_WARN("%s: flash_attn requires n_embd_head_k == n_embd_head_v - forcing off\n", __func__);
+        params.flash_attn = false;
+    }
+
     if (params.type_v != GGML_TYPE_F16 && !params.flash_attn) {
     if (params.type_v != GGML_TYPE_F16 && !params.flash_attn) {
         LLAMA_LOG_ERROR("%s: V cache quantization requires flash_attn\n", __func__);
         LLAMA_LOG_ERROR("%s: V cache quantization requires flash_attn\n", __func__);
         return nullptr;
         return nullptr;