From ebb70b9c123d89a6c63a10e9c71e370b867db48f Mon Sep 17 00:00:00 2001 From: Aleksandras Kostarevas Date: Tue, 19 Dec 2023 20:28:58 +0200 Subject: [PATCH] Fix build, disable gesture input pending model update --- java/res/values/gesture-input.xml | 2 +- .../org_futo_inputmethod_latin_xlm_LanguageModel.cpp | 10 +++++----- native/jni/src/ggml/LanguageModel.cpp | 2 +- native/jni/src/suggest/core/layout/proximity_info.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/java/res/values/gesture-input.xml b/java/res/values/gesture-input.xml index 445a389b8..235616fbe 100644 --- a/java/res/values/gesture-input.xml +++ b/java/res/values/gesture-input.xml @@ -18,5 +18,5 @@ */ --> - true + false diff --git a/native/jni/org_futo_inputmethod_latin_xlm_LanguageModel.cpp b/native/jni/org_futo_inputmethod_latin_xlm_LanguageModel.cpp index 3a7ba3b13..f2a2f4e94 100644 --- a/native/jni/org_futo_inputmethod_latin_xlm_LanguageModel.cpp +++ b/native/jni/org_futo_inputmethod_latin_xlm_LanguageModel.cpp @@ -271,7 +271,7 @@ struct LanguageModelState { if(num_added == 0){ AKLOGE("Somehow a token mix had 0 weight for everything"); - assert(false); + ASSERT(false); } embeds.insert(embeds.end(), mix_f.begin(), mix_f.end()); @@ -338,11 +338,11 @@ struct LanguageModelState { TIME_END(DecodeXBC) - assert(size == prompt.size() + n_tokens + 1); - assert(size == prompt.size() + (embeds.size() / n_embd) + 1); + ASSERT(size == prompt.size() + n_tokens + 1); + ASSERT(size == prompt.size() + (embeds.size() / n_embd) + 1); } else { - assert(size == prompt.size()); - assert(head == prompt_ff.first.size() - 1); + ASSERT(size == prompt.size()); + ASSERT(head == prompt_ff.first.size() - 1); } AKLOGI("-- Decode"); diff --git a/native/jni/src/ggml/LanguageModel.cpp b/native/jni/src/ggml/LanguageModel.cpp index b5167c826..3e84aab2c 100644 --- a/native/jni/src/ggml/LanguageModel.cpp +++ b/native/jni/src/ggml/LanguageModel.cpp @@ -84,7 +84,7 @@ LanguageModel *LlamaAdapter::createLanguageModel(const std::string &paths) { adapter->embeddings.resize(llama_n_embd(adapter->model) * llama_n_vocab(adapter->model)); auto tensor = llama_get_model_tensor(adapter->model, "token_embd.weight"); - assert(tensor); + ASSERT(tensor); if(tensor->type != GGML_TYPE_F32) { ggml_internal_get_type_traits(tensor->type).to_float(tensor->data, diff --git a/native/jni/src/suggest/core/layout/proximity_info.h b/native/jni/src/suggest/core/layout/proximity_info.h index a78a498ba..9bd5ba156 100644 --- a/native/jni/src/suggest/core/layout/proximity_info.h +++ b/native/jni/src/suggest/core/layout/proximity_info.h @@ -36,7 +36,7 @@ namespace insmat { AK_FORCE_INLINE float section(float h, float r = 1) // returns the positive root of intersection of line y = h with circle centered at the origin and radius r { - assert(r >= 0); // assume r is positive, leads to some simplifications in the formula below (can factor out r from the square root) + ASSERT(r >= 0); // assume r is positive, leads to some simplifications in the formula below (can factor out r from the square root) return (h < r)? sqrt(r * r - h * h) : 0; // http://www.wolframalpha.com/input/?i=r+*+sin%28acos%28x+%2F+r%29%29+%3D+h } @@ -63,7 +63,7 @@ namespace insmat { else return area(x0, x1, 0, -y0, r) + area(x0, x1, 0, y1, r); // the box is both above and below, divide it to two boxes and go again } else { - assert(y1 >= 0); // y0 >= 0, which means that y1 >= 0 also (y1 >= y0) because of the swap at the beginning + ASSERT(y1 >= 0); // y0 >= 0, which means that y1 >= 0 also (y1 >= y0) because of the swap at the beginning return area(x0, x1, y0, r) - area(x0, x1, y1, r); // area of the lower box minus area of the higher box } }