feat: prompt entered once in SelvaFeatureExtractor, reused by SelvaSampler

SelvaFeatureExtractor now stores the prompt in SELVA_FEATURES (both in the
returned dict and the .npz cache). SelvaSampler's prompt is now optional —
when left empty it falls back to the prompt stored in features. A non-empty
override can still be passed when CLIP text should differ from the sync text.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-04 16:22:59 +02:00
parent 0e417f4078
commit 27b4424e1a
2 changed files with 21 additions and 6 deletions
+6 -1
View File
@@ -150,6 +150,7 @@ class SelvaFeatureExtractor:
clip_features=clip_features.cpu().float().numpy(),
sync_features=sync_features.cpu().float().numpy(),
duration=float(duration),
prompt=np.array(prompt),
)
print(f"[SelVA] Features cached: {cached_path}", flush=True)
@@ -157,13 +158,17 @@ class SelvaFeatureExtractor:
"clip_features": clip_features.cpu(),
"sync_features": sync_features.cpu(),
"duration": float(duration),
"prompt": prompt,
}, float(fps))
def _load_cached(path):
data = np.load(path, allow_pickle=False)
return {
features = {
"clip_features": torch.from_numpy(data["clip_features"]),
"sync_features": torch.from_numpy(data["sync_features"]),
"duration": float(data["duration"]),
}
if "prompt" in data:
features["prompt"] = str(data["prompt"])
return features