From 37298aac90236390555f641c31aca4499fb69e96 Mon Sep 17 00:00:00 2001 From: Plamen Minev Date: Wed, 4 Dec 2024 17:07:53 +0200 Subject: [PATCH 1/2] feat: update llama.cpp submodule fix: compilation due to the removal of tfs_z sampler --- code/ac/llama/Sampler.cpp | 1 - code/ac/llama/Sampler.hpp | 2 -- llama.cpp | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/code/ac/llama/Sampler.cpp b/code/ac/llama/Sampler.cpp index 230a9f0..146acc6 100644 --- a/code/ac/llama/Sampler.cpp +++ b/code/ac/llama/Sampler.cpp @@ -81,7 +81,6 @@ Sampler::Sampler(Model& model, const Params& params) switch (type) { case SamplingType::Top_K: return llama_sampler_init_top_k(params.topK); - case SamplingType::Tfs_Z: return llama_sampler_init_tail_free(params.tfsZ, minKeep); case SamplingType::Typical_P: return llama_sampler_init_typical(params.typicalP, minKeep); case SamplingType::Top_P: return llama_sampler_init_top_p(params.topP, minKeep); case SamplingType::Min_P: return llama_sampler_init_min_p(params.minP, minKeep); diff --git a/code/ac/llama/Sampler.hpp b/code/ac/llama/Sampler.hpp index e68ceac..2b34b83 100644 --- a/code/ac/llama/Sampler.hpp +++ b/code/ac/llama/Sampler.hpp @@ -24,7 +24,6 @@ class AC_LLAMA_EXPORT Sampler { Top_K, Top_P, Min_P, - Tfs_Z, Typical_P, Temperature, XTC, @@ -68,7 +67,6 @@ class AC_LLAMA_EXPORT Sampler { std::vector samplerSequence = { SamplingType::Top_K, - SamplingType::Tfs_Z, SamplingType::Typical_P, SamplingType::Top_P, SamplingType::Min_P, diff --git a/llama.cpp b/llama.cpp index 8841ce3..59f4db1 160000 --- a/llama.cpp +++ b/llama.cpp @@ -1 +1 @@ -Subproject commit 8841ce3f439de6e770f70319b7e08b6613197ea7 +Subproject commit 59f4db10883a4f3e855cffbf2c3ab68430e95272 From 4886ada175c98112fe95ba7ba72e14fea9c52686 Mon Sep 17 00:00:00 2001 From: Plamen Minev Date: Wed, 4 Dec 2024 17:08:57 +0200 Subject: [PATCH 2/2] fix: tests --- test/t-ChatFormat.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/t-ChatFormat.cpp b/test/t-ChatFormat.cpp index 9c141e1..c88c22a 100644 --- a/test/t-ChatFormat.cpp +++ b/test/t-ChatFormat.cpp @@ -32,11 +32,11 @@ TEST_CASE("apply") { }, { // TheBloke/FusionNet_34Bx2_MoE-AWQ "{%- for idx in range(0, messages|length) -%}\\n{%- if messages[idx]['role'] == 'user' -%}\\n{%- if idx > 1 -%}\\n{{- bos_token + '[INST] ' + messages[idx]['content'] + ' [/INST]' -}}\\n{%- else -%}\\n{{- messages[idx]['content'] + ' [/INST]' -}}\\n{%- endif -%}\\n{% elif messages[idx]['role'] == 'system' %}\\n{{- '[INST] <>\\\\n' + messages[idx]['content'] + '\\\\n<>\\\\n\\\\n' -}}\\n{%- elif messages[idx]['role'] == 'assistant' -%}\\n{{- ' ' + messages[idx]['content'] + ' ' + eos_token -}}\\n{% endif %}\\n{% endfor %}", - "[INST] <>\nYou are a helpful assistant\n<>\n\nHello [/INST] Hi there [INST] Who are you [/INST] I am an assistant [INST] Another question [/INST]", + "[INST] <>\nYou are a helpful assistant\n<>\n\nHello [/INST]Hi there[INST] Who are you [/INST] I am an assistant [INST] Another question [/INST]", }, { // bofenghuang/vigogne-2-70b-chat "{{ bos_token }}{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% elif true == true and not '<>' in messages[0]['content'] %}{% set loop_messages = messages %}{% set system_message = 'Vous êtes Vigogne, un assistant IA créé par Zaion Lab. Vous suivez extrêmement bien les instructions. Aidez autant que vous le pouvez.' %}{% else %}{% set loop_messages = messages %}{% set system_message = false %}{% endif %}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if loop.index0 == 0 and system_message != false %}{% set content = '<>\\\\n' + system_message + '\\\\n<>\\\\n\\\\n' + message['content'] %}{% else %}{% set content = message['content'] %}{% endif %}{% if message['role'] == 'user' %}{{ '[INST] ' + content.strip() + ' [/INST]' }}{% elif message['role'] == 'system' %}{{ '<>\\\\n' + content.strip() + '\\\\n<>\\\\n\\\\n' }}{% elif message['role'] == 'assistant' %}{{ ' ' + content.strip() + ' ' + eos_token }}{% endif %}{% endfor %}", - "[INST] <>\nYou are a helpful assistant\n<>\n\nHello [/INST] Hi there [INST] Who are you [/INST] I am an assistant [INST] Another question [/INST]", + "[INST] <>\nYou are a helpful assistant\n<>\n\nHello [/INST]Hi there[INST] Who are you [/INST]I am an assistant[INST] Another question [/INST]", }, { // mlabonne/AlphaMonarch-7B "{% for message in messages %}{{bos_token + message['role'] + '\\n' + message['content'] + eos_token + '\\n'}}{% endfor %}{% if add_generation_prompt %}{{ bos_token + 'assistant\\n' }}{% endif %}",