From 63b439157340751efd1fdd2e5acdaf689649f37d Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Sun, 5 Apr 2026 15:44:26 +0200 Subject: [PATCH] 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 --- LORA_TRAINING.md | 10 +++++----- nodes/selva_feature_extractor.py | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/LORA_TRAINING.md b/LORA_TRAINING.md index 6cc090b..eebafe8 100644 --- a/LORA_TRAINING.md +++ b/LORA_TRAINING.md @@ -34,7 +34,7 @@ For each video clip you want to train on: 1. Load the video with a VHS LoadVideo node. 2. Connect it to **SelVA Feature Extractor**. 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. 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/ - dog_bark.npz ← from SelVA Feature Extractor - dog_bark.wav ← clean isolated audio recording - dog_bark_001.npz - dog_bark_001.wav + dog_bark_001.npz ← from SelVA Feature Extractor + dog_bark_001.wav ← clean isolated audio recording dog_bark_002.npz dog_bark_002.wav + dog_bark_003.npz + dog_bark_003.wav ``` Supported audio formats: `.wav`, `.flac`, `.mp3`, `.ogg`, `.aiff`, `.aif` diff --git a/nodes/selva_feature_extractor.py b/nodes/selva_feature_extractor.py index 0d17537..5e50f76 100644 --- a/nodes/selva_feature_extractor.py +++ b/nodes/selva_feature_extractor.py @@ -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")