Use cached files when HF API fails

Signed-off-by: Adrien Gallouët <angt@huggingface.co>
This commit is contained in:
Adrien Gallouët 2026-03-22 09:30:30 +00:00
parent 5572986afa
commit 74c1874072
No known key found for this signature in database
1 changed files with 8 additions and 2 deletions

View File

@ -595,10 +595,16 @@ static hf_plan get_hf_plan(const common_params_model & model,
const std::string & token,
const common_download_model_opts & opts) {
hf_plan plan;
hf_cache::hf_files all;
auto [repo, tag] = common_download_split_repo_tag(model.hf_repo);
auto all = opts.offline ? hf_cache::get_cached_files(repo)
: hf_cache::get_repo_files(repo, token);
if (!opts.offline) {
all = hf_cache::get_repo_files(repo, token);
}
if (all.empty()) {
all = hf_cache::get_cached_files(repo);
}
if (all.empty()) {
return plan;
}