@@ -4653,8 +4653,16 @@ static void llm_load_vocab(
4653
4653
4654
4654
// for now, only BPE models have pre-tokenizers
4655
4655
if (vocab.type == LLAMA_VOCAB_TYPE_BPE) {
4656
- if (
4657
- tokenizer_pre == "default") {
4656
+ if (tokenizer_pre.empty()) {
4657
+ LLAMA_LOG_WARN("%s: missing pre-tokenizer type, using: 'default'\n", __func__);
4658
+ LLAMA_LOG_WARN("%s: \n", __func__);
4659
+ LLAMA_LOG_WARN("%s: ************************************ \n", __func__);
4660
+ LLAMA_LOG_WARN("%s: GENERATION QUALITY WILL BE DEGRADED! \n", __func__);
4661
+ LLAMA_LOG_WARN("%s: CONSIDER REGENERATING THE MODEL \n", __func__);
4662
+ LLAMA_LOG_WARN("%s: ************************************ \n", __func__);
4663
+ LLAMA_LOG_WARN("%s: \n", __func__);
4664
+ vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
4665
+ } else if (tokenizer_pre == "default") {
4658
4666
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
4659
4667
} else if (
4660
4668
tokenizer_pre == "llama3" ||
@@ -4710,7 +4718,7 @@ static void llm_load_vocab(
4710
4718
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
4711
4719
}
4712
4720
} else {
4713
- vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT ;
4721
+ throw std::runtime_error(format("unknown pre-tokenizer type: '%s'", tokenizer_pre.c_str())) ;
4714
4722
}
4715
4723
}
4716
4724
@@ -6623,7 +6631,7 @@ static int llama_model_load(const std::string & fname, llama_model & model, llam
6623
6631
}
6624
6632
} catch (const std::exception & err) {
6625
6633
LLAMA_LOG_ERROR("%s: error loading model: %s\n", __func__, err.what());
6626
- throw ;
6634
+ return -1 ;
6627
6635
}
6628
6636
6629
6637
return 0;
@@ -16247,22 +16255,16 @@ struct llama_model * llama_load_model_from_file(
16247
16255
model->rpc_servers.push_back(servers);
16248
16256
}
16249
16257
16250
- try {
16251
- int status = llama_model_load(path_model, *model, params);
16252
- GGML_ASSERT(status <= 0);
16253
- if (status < 0) {
16254
- if (status == -1) {
16255
- LLAMA_LOG_ERROR("%s: failed to load model\n", __func__);
16256
- } else if (status == -2) {
16257
- LLAMA_LOG_INFO("%s: cancelled model load\n", __func__);
16258
- }
16259
- delete model;
16260
- return nullptr;
16258
+ int status = llama_model_load(path_model, *model, params);
16259
+ GGML_ASSERT(status <= 0);
16260
+ if (status < 0) {
16261
+ if (status == -1) {
16262
+ LLAMA_LOG_ERROR("%s: failed to load model\n", __func__);
16263
+ } else if (status == -2) {
16264
+ LLAMA_LOG_INFO("%s: cancelled model load\n", __func__);
16261
16265
}
16262
- } catch (...) {
16263
- LLAMA_LOG_ERROR("%s: exception loading model\n", __func__);
16264
16266
delete model;
16265
- throw ;
16267
+ return nullptr ;
16266
16268
}
16267
16269
16268
16270
return model;
0 commit comments