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:
@@ -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},)
|
||||
|
||||
Reference in New Issue
Block a user