05-default-pretokenizer.diff 1.7 KB

1234567891011121314151617181920212223242526272829303132
  1. diff --git a/llama.cpp b/llama.cpp
  2. index 40d2ec2c..74f3ee9c 100644
  3. --- a/llama.cpp
  4. +++ b/llama.cpp
  5. @@ -4642,16 +4642,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 (
  18. + if (
  19. tokenizer_pre == "default") {
  20. vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
  21. } else if (
  22. @@ -4703,7 +4694,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;