fix: named .npz files always start at _001

dog_bark_001.npz, dog_bark_002.npz instead of dog_bark.npz, dog_bark_001.npz.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-05 15:44:26 +02:00
parent 89af5a468c
commit 63b4391573
2 changed files with 5 additions and 8 deletions
-3
View File
@@ -72,9 +72,6 @@ def _resolve_named_path(cache_dir: str, name: str) -> str:
"""Return cache_dir/name.npz, incrementing to name_001.npz etc. if the file already exists."""
# Sanitize: replace path separators so the name stays inside cache_dir
name = name.replace("/", "_").replace("\\", "_").replace("\x00", "_")
base = os.path.join(cache_dir, f"{name}.npz")
if not os.path.exists(base):
return base
i = 1
while True:
p = os.path.join(cache_dir, f"{name}_{i:03d}.npz")