Skip to content

Commit 404daca

Browse files
author
Joan Martinez
committed
fix: remove ollama patches
1 parent 3b44f8f commit 404daca

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

llama.cpp

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4653,8 +4653,16 @@ static void llm_load_vocab(
46534653

46544654
// for now, only BPE models have pre-tokenizers
46554655
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") {
46584666
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
46594667
} else if (
46604668
tokenizer_pre == "llama3" ||
@@ -4710,7 +4718,7 @@ static void llm_load_vocab(
47104718
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
47114719
}
47124720
} 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()));
47144722
}
47154723
}
47164724

@@ -6623,7 +6631,7 @@ static int llama_model_load(const std::string & fname, llama_model & model, llam
66236631
}
66246632
} catch (const std::exception & err) {
66256633
LLAMA_LOG_ERROR("%s: error loading model: %s\n", __func__, err.what());
6626-
throw;
6634+
return -1;
66276635
}
66286636

66296637
return 0;
@@ -16247,22 +16255,16 @@ struct llama_model * llama_load_model_from_file(
1624716255
model->rpc_servers.push_back(servers);
1624816256
}
1624916257

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__);
1626116265
}
16262-
} catch (...) {
16263-
LLAMA_LOG_ERROR("%s: exception loading model\n", __func__);
1626416266
delete model;
16265-
throw;
16267+
return nullptr;
1626616268
}
1626716269

1626816270
return model;

0 commit comments

Comments
 (0)