Skip to content

Commit 9254920

Browse files
authored
baby-llama : fix operator!= (#1821)
* 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. * Update baby-llama.cpp * Update baby-llama.cpp
1 parent e32089b commit 9254920

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/baby-llama/baby-llama.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ struct llama_hparams_lora {
153153
uint32_t n_rot = 64;
154154
uint32_t n_lora = 64;
155155

156-
bool operator!=(const llama_hparams & other) const {
157-
return memcmp(this, &other, sizeof(llama_hparams));
156+
bool operator!=(const llama_hparams_lora & other) const {
157+
return memcmp(this, &other, sizeof(llama_hparams_lora)) != 0;
158158
}
159159
};
160160

0 commit comments

Comments
 (0)