Distribute and run LLMs with a single file.
C++ cross-platformggufllama-cpplocal-ailocal-inferencelocal-llmopen-source-aisingle-file-executablespeech-to-text
add support for DeepSeek-R1 models
Xydane854228015317
diff --git a/llama.cpp/llama.cpp b/llama.cpp/llama.cppindex 21b582f0..84fa28f6 100644--- a/llama.cpp/llama.cpp+++ b/llama.cpp/llama.cpp@@ -5187,7 +5187,7 @@ static void llm_load_vocab(vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_COMMAND_R;vocab.tokenizer_clean_spaces = false;} else if (- tokenizer_pre == "qwen2") {+ tokenizer_pre == "qwen2" || tokenizer_pre == "deepseek-r1-qwen") {vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_QWEN2;vocab.tokenizer_clean_spaces = false;} else if (@@ -5427,7 +5427,7 @@ static void llm_load_vocab(t.first == "<|im_end|>" ||t.first == "<|end|>" ||t.first == "<end_of_turn>" ||- t.first == "<|endoftext|>"+ t.first == "<|endoftext|>")) {vocab.special_eot_id = t.second;@@ -19160,6 +19160,21 @@ static int32_t llama_chat_apply_template_internal(if (add_ass) {ss << "Assistant:";}+ } else if (tmpl == "deepseek3" || tmpl_contains(LU8("<|Assistant|>")) && tmpl_contains(LU8("<|User|>")) && tmpl_contains(LU8("<|end▁of▁sentence|>"))) {+ // DeepSeek-V3+ for (auto message : chat) {+ std::string role(message->role);+ if (role == "system") {+ ss << message->content << "\n\n";+ } else if (role == "user") {+ ss << LU8("<|User|>") << message->content;+ } else if (role == "assistant") {+ ss << LU8("<|Assistant|>") << message->content << LU8("<|end▁of▁sentence|>");+ }+ }+ if (add_ass) {+ ss << LU8("<|Assistant|>");+ }} else if (tmpl == "exaone3" || (tmpl_contains("[|system|]") && tmpl_contains("[|assistant|]") && tmpl_contains("[|endofturn|]"))) {// ref: https://huggingface.co/LGAI-EXAONE/EXAONE-3.0-7.8B-Instruct/discussions/8#66bae61b1893d14ee8ed85bb// EXAONE-3.0-7.8B-Instruct