summaryrefslogtreecommitdiff
path: root/llama.cpp
diff options
context:
space:
mode:
authorFrank Mai <thxcode0824@gmail.com>2024-06-17 22:11:08 +0800
committerGitHub <noreply@github.com>2024-06-17 16:11:08 +0200
commitc637fcd34d135a9ff4f97d3a53ad03a910a4a31f (patch)
treec27780efed97bace9bee02ab6e27fdc17cb6031a /llama.cpp
parent6a2f0b3474d479bda4ac2ee7cfd5dcdcf0be1f79 (diff)
fix: divide 0 exception in mamba (#7932)
Signed-off-by: thxCode <thxcode0824@gmail.com>
Diffstat (limited to 'llama.cpp')
-rw-r--r--llama.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llama.cpp b/llama.cpp
index b324807f..dd7020dc 100644
--- a/llama.cpp
+++ b/llama.cpp
@@ -5383,7 +5383,7 @@ static bool llm_load_tensors(
// create tensors for the weights
{
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_v_gqa = hparams.n_embd_v_gqa();
const int64_t n_embd_gqa = n_embd_v_gqa;