05-default-pretokenizer.diff 1.9 KB

1234567891011121314151617181920212223242526272829303132
  1. diff --git a/src/llama.cpp b/src/llama.cpp
  2. index 73f52435..2b81b4bd 100644
  3. --- a/src/llama.cpp
  4. +++ b/src/llama.cpp
  5. @@ -5092,16 +5092,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. @@ -5164,7 +5155,8 @@ static void llm_load_vocab(
  23. tokenizer_pre == "jais") {
  24. vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_JAIS;
  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 if (vocab.type == LLAMA_VOCAB_TYPE_SPM) {
  31. vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;