mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 17:15:19 -07:00
fix(cache): don't treat orphaned .incomplete blobs as an in-progress download
is_model_cached() marked a model as not-cached whenever any .incomplete blob existed in its cache dir, even when a completed blob with the same hash already sat next to it. A retried/concurrent download can leave this orphan behind after the real transfer already finished, which made the model appear perpetually "downloading" and re-trigger a full re-download on every load. Only .incomplete files with no matching completed blob now count as a genuinely in-progress download.
This commit is contained in:
committed by
capy-ai-staging[bot]
parent
6ad47dda89
commit
f62aff0809
@@ -48,11 +48,18 @@ def is_model_cached(
|
||||
if not repo_cache.exists():
|
||||
return False
|
||||
|
||||
# Incomplete blobs mean a download is still in progress
|
||||
# An .incomplete blob means a download is still in progress -- unless
|
||||
# a completed blob with the same hash already sits next to it, which
|
||||
# happens when a retried/concurrent download leaves a stale .incomplete
|
||||
# behind after the real transfer already finished. Only orphaned
|
||||
# .incomplete files (no matching completed blob) count as "in progress".
|
||||
blobs_dir = repo_cache / "blobs"
|
||||
if blobs_dir.exists() and any(blobs_dir.glob("*.incomplete")):
|
||||
logger.debug(f"Found .incomplete files for {hf_repo}")
|
||||
return False
|
||||
if blobs_dir.exists():
|
||||
for incomplete in blobs_dir.glob("*.incomplete"):
|
||||
completed = incomplete.with_name(incomplete.name.removesuffix(".incomplete"))
|
||||
if not completed.exists():
|
||||
logger.debug(f"Found in-progress .incomplete file for {hf_repo}")
|
||||
return False
|
||||
|
||||
snapshots_dir = repo_cache / "snapshots"
|
||||
if not snapshots_dir.exists():
|
||||
|
||||
Reference in New Issue
Block a user