From 9677a1f2c895979c8a8fc2b68002fca4bac8c5fb Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Tue, 23 Jan 2024 22:28:03 -0500 Subject: [PATCH] fix: Check order --- llama_cpp/llama.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llama_cpp/llama.py b/llama_cpp/llama.py index 3d15800..74739cb 100644 --- a/llama_cpp/llama.py +++ b/llama_cpp/llama.py @@ -205,15 +205,15 @@ class Llama: for i, (k, v) in enumerate(kv_overrides.items()): self._kv_overrides_array[i].key = k.encode("utf-8") - if isinstance(v, int): + if isinstance(v, bool): + self._kv_overrides_array[i].tag = llama_cpp.LLAMA_KV_OVERRIDE_BOOL + self._kv_overrides_array[i].value.bool_value = v + elif isinstance(v, int): self._kv_overrides_array[i].tag = llama_cpp.LLAMA_KV_OVERRIDE_INT self._kv_overrides_array[i].value.int_value = v elif isinstance(v, float): self._kv_overrides_array[i].tag = llama_cpp.LLAMA_KV_OVERRIDE_FLOAT self._kv_overrides_array[i].value.float_value = v - elif isinstance(v, bool): - self._kv_overrides_array[i].tag = llama_cpp.LLAMA_KV_OVERRIDE_BOOL - self._kv_overrides_array[i].value.bool_value = v else: raise ValueError(f"Unknown value type for {k}: {v}")