From 51753757151f7f7084ed223153ee40daa3c598ea Mon Sep 17 00:00:00 2001 From: Molly Sophia Date: Sat, 31 Aug 2024 11:59:30 +0800 Subject: [PATCH] llama: rwkv6: Avoid division by zero Co-authored-by: compilade --- src/llama.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llama.cpp b/src/llama.cpp index 6c374277d4138..8249756e9bfb7 100644 --- a/src/llama.cpp +++ b/src/llama.cpp @@ -15156,7 +15156,7 @@ struct llm_build_context { ) ); - if ((il + 1) % hparams.rescale_every_n_layers == 0) { + if (hparams.rescale_every_n_layers != 0 && (il + 1) % hparams.rescale_every_n_layers == 0) { cur = ggml_scale(ctx0, cur, 0.5F); }