Skip to content

Commit d7b5bf8

Browse files
committed
small fixes
1 parent 242135e commit d7b5bf8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

common/arg.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ std::string common_arg::to_string() {
135135
* - bartowski/Llama-3.2-3B-Instruct-GGUF:Q4_K_M
136136
* - bartowski/Llama-3.2-3B-Instruct-GGUF:q5_k_s
137137
* Tag is optional, default to "latest" (meaning it checks for Q4_K_M first, then Q4, then if not found, return the first GGUF file in repo)
138+
*
138139
* Return pair of <repo, file> (with "repo" already having tag removed)
140+
*
141+
* Note: we use the Ollama-compatible HF API, but not using the blobId. Instead, we use the special "ggufFile" field which returns the value for "hf_file". This is done to be backward-compatible with existing cache files.
139142
*/
140143
static std::pair<std::string, std::string> common_get_hf_file(const std::string & hf_repo_with_tag, const std::string & hf_token) {
141144
auto parts = string_split<std::string>(hf_repo_with_tag, ':');
@@ -219,15 +222,17 @@ static void common_params_handle_model_default(
219222
auto auto_detected = common_get_hf_file(hf_repo, hf_token);
220223
hf_repo = auto_detected.first;
221224
hf_file = auto_detected.second;
222-
printf("%s: using hf_file = %s\n", __func__, hf_file.c_str());
225+
LOG_INF("%s: using hf_file = %s\n", __func__, hf_file.c_str());
223226
} catch (std::exception & e) {
224227
fprintf(stderr, "%s: %s\n", __func__, e.what());
225228
exit(1);
226229
}
227230
} else {
228231
hf_file = model;
229232
}
230-
} else if (model.empty()) {
233+
}
234+
// make sure model path is present (for caching purposes)
235+
if (model.empty()) {
231236
// this is to avoid different repo having same file name, or same file name in different subdirs
232237
std::string filename = hf_repo + "_" + hf_file;
233238
// to make sure we don't have any slashes in the filename

0 commit comments

Comments
 (0)