Skip to content

Commit 8bd5b18

Browse files
committed
fix complain with noreturn
1 parent 22927b1 commit 8bd5b18

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

common/arg.cpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,12 @@ static void common_params_handle_model_default(
138138
// short-hand to avoid specifying --hf-file -> default it to --model
139139
if (hf_file.empty()) {
140140
if (model.empty()) {
141-
try {
142-
auto auto_detected = common_get_hf_file(hf_repo, hf_token);
143-
hf_repo = auto_detected.first;
144-
hf_file = auto_detected.second;
145-
LOG_INF("%s: using hf_file = %s\n", __func__, hf_file.c_str());
146-
} catch (std::exception & e) {
147-
fprintf(stderr, "%s: %s\n", __func__, e.what());
148-
exit(1);
141+
auto auto_detected = common_get_hf_file(hf_repo, hf_token);
142+
if (auto_detected.first.empty() || auto_detected.second.empty()) {
143+
exit(1); // built without CURL, error message already printed
149144
}
145+
hf_repo = auto_detected.first;
146+
hf_file = auto_detected.second;
150147
} else {
151148
hf_file = model;
152149
}

common/common.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,8 @@ struct llama_model * common_load_model_from_hf(
15551555
}
15561556

15571557
std::pair<std::string, std::string> common_get_hf_file(const std::string &, const std::string &) {
1558-
throw std::runtime_error("error: llama.cpp built without libcurl, downloading from Hugging Face not supported.");
1558+
LOG_WRN("%s: llama.cpp built without libcurl, downloading from Hugging Face not supported.\n", __func__);
1559+
return std::make_pair("", "");
15591560
}
15601561

15611562
#endif // LLAMA_USE_CURL

0 commit comments

Comments
 (0)