Просмотр исходного кода

fix: divide 0 exception in mamba (#7932)

Signed-off-by: thxCode <thxcode0824@gmail.com>
Frank Mai 1 год назад
Родитель
Сommit
c637fcd34d
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      llama.cpp

+ 1 - 1
llama.cpp

@@ -5383,7 +5383,7 @@ static bool llm_load_tensors(
     // create tensors for the weights
     // create tensors for the weights
     {
     {
         const int64_t n_embd       = hparams.n_embd;
         const int64_t n_embd       = hparams.n_embd;
-        const int64_t n_embd_head  = n_embd / hparams.n_head;
+        const int64_t n_embd_head  = (hparams.n_head == 0) ? 0 : n_embd / hparams.n_head;
         const int64_t n_embd_k_gqa = hparams.n_embd_k_gqa();
         const int64_t n_embd_k_gqa = hparams.n_embd_k_gqa();
         const int64_t n_embd_v_gqa = hparams.n_embd_v_gqa();
         const int64_t n_embd_v_gqa = hparams.n_embd_v_gqa();
         const int64_t n_embd_gqa   = n_embd_v_gqa;
         const int64_t n_embd_gqa   = n_embd_v_gqa;