From 9301ff0624c9bcb76e7d2fdd24f836a442e5f947 Mon Sep 17 00:00:00 2001 From: 0xspringtime <110655352+0xspringtime@users.noreply.github.com> Date: Mon, 12 Jun 2023 09:58:07 -0400 Subject: [PATCH 1/3] Update baby-llama.cpp Seems to be an error in the implementation of the operator!= function. It attempts to compare the this pointer (a llama_hparams_lora object) with the other pointer (a llama_hparams object) using memcmp. This can lead to incorrect results because the sizes of the objects being compared (sizeof(llama_hparams) and sizeof(llama_hparams_lora)) are different, should now be able to compare two llama_hparams_lora objects for inequality. --- examples/baby-llama/baby-llama.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/baby-llama/baby-llama.cpp b/examples/baby-llama/baby-llama.cpp index 5573c154b56..d38cf048e67 100644 --- a/examples/baby-llama/baby-llama.cpp +++ b/examples/baby-llama/baby-llama.cpp @@ -149,7 +149,7 @@ struct llama_hparams_lora { uint32_t n_lora = 64; bool operator!=(const llama_hparams & other) const { - return memcmp(this, &other, sizeof(llama_hparams)); + return memcmp(this, &other, sizeof(llama_hparams)) != 0; } }; From 55290ba801c36878dac7da3e06518ebbe74011df Mon Sep 17 00:00:00 2001 From: 0xspringtime <110655352+0xspringtime@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:45:19 -0400 Subject: [PATCH 2/3] Update baby-llama.cpp --- examples/baby-llama/baby-llama.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/baby-llama/baby-llama.cpp b/examples/baby-llama/baby-llama.cpp index d38cf048e67..031966defbb 100644 --- a/examples/baby-llama/baby-llama.cpp +++ b/examples/baby-llama/baby-llama.cpp @@ -148,10 +148,9 @@ struct llama_hparams_lora { uint32_t n_rot = 64; uint32_t n_lora = 64; - bool operator!=(const llama_hparams & other) const { - return memcmp(this, &other, sizeof(llama_hparams)) != 0; + bool operator!=(const llama_hparams_lora & other) const { + return memcmp(this, &other, sizeof(llama_hparams_lora)) != 0; } -}; struct llama_layer { // normalization From 335cc1eb3ad6ae17f3a32bbd65ca3f2bd39694b9 Mon Sep 17 00:00:00 2001 From: 0xspringtime <110655352+0xspringtime@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:50:43 -0400 Subject: [PATCH 3/3] Update baby-llama.cpp --- examples/baby-llama/baby-llama.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/baby-llama/baby-llama.cpp b/examples/baby-llama/baby-llama.cpp index 031966defbb..337ef5116e4 100644 --- a/examples/baby-llama/baby-llama.cpp +++ b/examples/baby-llama/baby-llama.cpp @@ -151,6 +151,7 @@ struct llama_hparams_lora { bool operator!=(const llama_hparams_lora & other) const { return memcmp(this, &other, sizeof(llama_hparams_lora)) != 0; } +}; struct llama_layer { // normalization