From e7ef3aab0fff5f2defdf68f6983b3cd0d8a7ffed Mon Sep 17 00:00:00 2001 From: Jason Stevens Date: Wed, 31 Dec 2025 15:45:28 -0800 Subject: [PATCH] Assume LFS OID is SHA256 value if SHA256 field missing from LFS Info. This fix allows models that have been updated in their repo to be detected as hash mismatch and re-downloaded. The Hugging face api does not have a field 'SHA' or 'SHA256' on LFS files. The LFS oid is the SHA256 hash of the file so use that when the LFS SHA256 is missing, which it always will be. Api example: https://huggingface.co/api/models/Qwen/Qwen3-0.6B/tree/main --- pkg/hfdownloader/plan.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/hfdownloader/plan.go b/pkg/hfdownloader/plan.go index f02b92f..b4e1e51 100644 --- a/pkg/hfdownloader/plan.go +++ b/pkg/hfdownloader/plan.go @@ -117,6 +117,11 @@ func scanRepo(ctx context.Context, httpc *http.Client, token string, job Job, cf sha = n.LFS.Sha256 } + // if sha not loaded from HF json repo API use the LFS file OID instead (the HF API does not contain the SHA256 hash, so this is alway true for LFS files) + if sha == "" && n.LFS != nil { + sha = n.LFS.Oid + } + items = append(items, PlanItem{ RelativePath: rel, URL: urlStr,