02-llamacpp.diff 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. diff --git a/llama/llama.cpp b/llama/llama.cpp
  2. index 8b675ea9..bcc6ae75 100644
  3. --- a/llama/llama.cpp
  4. +++ b/llama/llama.cpp
  5. @@ -4645,16 +4645,7 @@ static void llm_load_vocab(
  6. // for now, only BPE models have pre-tokenizers
  7. if (vocab.type == LLAMA_VOCAB_TYPE_BPE) {
  8. - if (tokenizer_pre.empty()) {
  9. - LLAMA_LOG_WARN("%s: missing pre-tokenizer type, using: 'default'\n", __func__);
  10. - LLAMA_LOG_WARN("%s: \n", __func__);
  11. - LLAMA_LOG_WARN("%s: ************************************ \n", __func__);
  12. - LLAMA_LOG_WARN("%s: GENERATION QUALITY WILL BE DEGRADED! \n", __func__);
  13. - LLAMA_LOG_WARN("%s: CONSIDER REGENERATING THE MODEL \n", __func__);
  14. - LLAMA_LOG_WARN("%s: ************************************ \n", __func__);
  15. - LLAMA_LOG_WARN("%s: \n", __func__);
  16. - vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
  17. - } else if (tokenizer_pre == "default") {
  18. + if (tokenizer_pre == "default") {
  19. vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
  20. } else if (
  21. tokenizer_pre == "llama3" ||
  22. @@ -4706,7 +4697,8 @@ static void llm_load_vocab(
  23. tokenizer_pre == "smaug-bpe") {
  24. vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_SMAUG;
  25. } else {
  26. - throw std::runtime_error(format("unknown pre-tokenizer type: '%s'", tokenizer_pre.c_str()));
  27. + LLAMA_LOG_WARN("%s: missing or unrecognized pre-tokenizer type, using: 'default'\n", __func__);
  28. + vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
  29. }
  30. } else {
  31. vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
  32. @@ -7009,7 +7001,7 @@ static struct ggml_tensor * llm_build_kqv(
  33. struct ggml_tensor * kq = ggml_mul_mat(ctx, k, q);
  34. cb(kq, "kq", il);
  35. - if (model.arch == LLM_ARCH_PHI2 || model.arch == LLM_ARCH_PHI3 || model.arch == LLM_ARCH_GPTNEOX) {
  36. + if (model.arch == LLM_ARCH_PHI2 || model.arch == LLM_ARCH_PHI3 || model.arch == LLM_ARCH_GPTNEOX || model.arch == LLM_ARCH_QWEN2) {
  37. // for this arch, we need to perform the KQ multiplication with F32 precision, otherwise we get NaNs
  38. // ref: https://github.com/ggerganov/llama.cpp/pull/4490#issuecomment-1859055847
  39. ggml_mul_mat_set_prec(kq, GGML_PREC_F32);