From 74c1874072827180d401827d4e1ebc47de9772a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Sun, 22 Mar 2026 09:30:30 +0000 Subject: [PATCH] Use cached files when HF API fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien Gallouët --- common/download.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/download.cpp b/common/download.cpp index cf28d624fc..ebf4938d23 100644 --- a/common/download.cpp +++ b/common/download.cpp @@ -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; }