fix: FlashSR device handling and remove unused tmp_out

Use device="auto" for audiosr.build_model — safer than passing a device
string that may not be accepted in all audiosr versions.
Remove unused tmp_out temp file that was created but never written to.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-09 16:32:02 +02:00
parent ce62bccc1f
commit ba0499b77c
+2 -6
View File
@@ -138,9 +138,7 @@ class SelvaFlashSR:
# AudioSR works on files — write to temp, process, read back
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as f:
tmp_in = Path(f.name)
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as f:
tmp_out = Path(f.name)
tmp_in = Path(f.name)
try:
wav_np = wav.float().numpy() # [C, T]
@@ -150,8 +148,7 @@ class SelvaFlashSR:
wav_np = wav_np.T # [T, C]
sf.write(str(tmp_in), wav_np, sr)
device = str(comfy.model_management.get_torch_device())
model = audiosr.build_model(model_name="basic", device=device)
model = audiosr.build_model(model_name="basic", device="auto")
result = audiosr.super_resolution(
model,
str(tmp_in),
@@ -170,7 +167,6 @@ class SelvaFlashSR:
finally:
tmp_in.unlink(missing_ok=True)
tmp_out.unlink(missing_ok=True)
print(f"[FlashSR] Done guidance={guidance_scale} steps={ddim_steps}", flush=True)
return ({"waveform": wav_out, "sample_rate": out_sr},)