From 13857f29d69b00961fe2df56bde1415f189e27a4 Mon Sep 17 00:00:00 2001 From: HanishKVC Date: Thu, 25 Apr 2024 18:49:53 +0530 Subject: [PATCH] ChatON+Main: Updates wrt detailed meta json Fix a oversight wrt key name. Add a alert in case if passed meta json file contains begin(BoS) wrt assistant role, similar to check for end (EoS) wrt user role. Bcas normally both (ie EoS wrt User and BoS wrt Assistant) shouldnt be needed. Update main wrt begin & prefix and suffix & end addition. --- common/chaton.hpp | 5 ++++- examples/main/main.cpp | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/chaton.hpp b/common/chaton.hpp index d3a8bfba5..7ea7b1932 100644 --- a/common/chaton.hpp +++ b/common/chaton.hpp @@ -75,7 +75,7 @@ const auto K_SUFFIX = "suffix"; const auto K_BEGIN = "begin"; const auto K_END = "end"; const auto K_GLOBAL = "global"; -const auto K_SYSTEMUSER_SYSTEM_HAS_SUFFIX = "systemuser-systemp-has-suffix"; +const auto K_SYSTEMUSER_SYSTEM_HAS_SUFFIX = "systemuser-system-has-suffix"; const auto K_SYSTEMUSER_SYSTEM_HAS_END = "systemuser-system-has-end"; const auto K_SYSTEMUSER_1ST_USER_HAS_BEGIN = "systemuser-1st-user-has-begin"; const auto K_SYSTEMUSER_1ST_USER_HAS_PREFIX = "systemuser-1st-user-has-prefix"; @@ -389,6 +389,9 @@ inline void _chaton_meta_dump(std::string &tmpl) { if (!userEnd.empty()) { LOG_TEELN("WARN:%s:User->End seems to be set to [%s], do cross check if this is proper and needed", __func__, userEnd.c_str()); } + if (!assistantBegin.empty()) { + LOG_TEELN("WARN:%s:Assistant->Begin seems to be set to [%s], do cross check if this is proper and needed", __func__, assistantBegin.c_str()); + } } } diff --git a/examples/main/main.cpp b/examples/main/main.cpp index a505c900b..074db4598 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -375,12 +375,12 @@ int main(int argc, char ** argv) { } // chaton mode - const auto chaton_assitant_prefix = ::llama_tokenize(ctx, chaton_tmpl_role_kv(params.chaton_template_id, K_ASSISTANT, {K_PREFIX}), false, true); + const auto chaton_assitant_prefix = ::llama_tokenize(ctx, chaton_tmpl_role_kv(params.chaton_template_id, K_ASSISTANT, {K_BEGIN, K_PREFIX}), false, true); if (params.chaton) { params.interactive = true; // may remove later, by requiring user to explicitly request interactive mode params.interactive_first = true; params.input_prefix = chaton_tmpl_role_kv(params.chaton_template_id, K_USER, {K_BEGIN, K_PREFIX}); - params.input_suffix = chaton_tmpl_role_kv(params.chaton_template_id, K_USER, {K_SUFFIX}); + params.input_suffix = chaton_tmpl_role_kv(params.chaton_template_id, K_USER, {K_SUFFIX, K_END}); params.antiprompt.emplace_back(chaton_tmpl_kv(params.chaton_template_id, K_REVERSE_PROMPT)); }