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
+5 -5
View File
@@ -34,7 +34,7 @@ For each video clip you want to train on:
1. Load the video with a VHS LoadVideo node. 1. Load the video with a VHS LoadVideo node.
2. Connect it to **SelVA Feature Extractor**. 2. Connect it to **SelVA Feature Extractor**.
3. Set **`cache_dir`** to a dedicated dataset folder, e.g. `dataset/my_sound`. 3. Set **`cache_dir`** to a dedicated dataset folder, e.g. `dataset/my_sound`.
4. Set **`name`** to a short descriptive label, e.g. `dog_bark`. The node will save `dog_bark.npz`, then `dog_bark_001.npz`, `dog_bark_002.npz`, etc. automatically as you process more clips. 4. Set **`name`** to a short descriptive label, e.g. `dog_bark`. The node will save `dog_bark_001.npz`, then `dog_bark_002.npz`, etc. automatically as you process more clips.
5. Set the **`prompt`** to describe the sound (e.g. `a dog barking`). This prompt is used to condition the sync features — be specific. 5. Set the **`prompt`** to describe the sound (e.g. `a dog barking`). This prompt is used to condition the sync features — be specific.
6. Optionally connect a **mask** to isolate the sound source in frame (recommended when the scene has multiple objects). 6. Optionally connect a **mask** to isolate the sound source in frame (recommended when the scene has multiple objects).
@@ -46,12 +46,12 @@ For each `.npz` file, place a matching audio file with the **same filename stem*
``` ```
dataset/my_sound/ dataset/my_sound/
dog_bark.npz ← from SelVA Feature Extractor dog_bark_001.npz ← from SelVA Feature Extractor
dog_bark.wav ← clean isolated audio recording dog_bark_001.wav ← clean isolated audio recording
dog_bark_001.npz
dog_bark_001.wav
dog_bark_002.npz dog_bark_002.npz
dog_bark_002.wav dog_bark_002.wav
dog_bark_003.npz
dog_bark_003.wav
``` ```
Supported audio formats: `.wav`, `.flac`, `.mp3`, `.ogg`, `.aiff`, `.aif` Supported audio formats: `.wav`, `.flac`, `.mp3`, `.ogg`, `.aiff`, `.aif`
-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.""" """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 # Sanitize: replace path separators so the name stays inside cache_dir
name = name.replace("/", "_").replace("\\", "_").replace("\x00", "_") 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 i = 1
while True: while True:
p = os.path.join(cache_dir, f"{name}_{i:03d}.npz") p = os.path.join(cache_dir, f"{name}_{i:03d}.npz")