From 687f67e40c2c5b94ab2da160fca40bad529854f4 Mon Sep 17 00:00:00 2001 From: shahules786 Date: Mon, 3 Oct 2022 21:21:27 +0530 Subject: [PATCH 1/2] write output fix --- enhancer/inference.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/enhancer/inference.py b/enhancer/inference.py index 2c63d54..fd2f57a 100644 --- a/enhancer/inference.py +++ b/enhancer/inference.py @@ -84,10 +84,15 @@ class Inference: if isinstance(filename,str): filename = Path(filename) + + parent, name = filename.parent, "cleaned_"+filename.name + filename = parent/Path(name) if filename.is_file(): raise FileExistsError(f"file {filename} already exists") else: - wavfile.write(filename,rate=sr,data=waveform.detach().cpu()) + if isinstance(waveform,torch.Tensor): + waveform = waveform.detach().cpu().squeeze().numpy() + wavfile.write(filename,rate=sr,data=waveform) @staticmethod def prepare_output(waveform:torch.Tensor, model_sampling_rate:int, From c609b57309ca841107343b65921308cbcc0ded3a Mon Sep 17 00:00:00 2001 From: shahules786 Date: Mon, 3 Oct 2022 21:22:15 +0530 Subject: [PATCH 2/2] fix typo --- enhancer/models/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enhancer/models/model.py b/enhancer/models/model.py index 5827301..de2edab 100644 --- a/enhancer/models/model.py +++ b/enhancer/models/model.py @@ -249,7 +249,7 @@ class Model(pl.LightningModule): else: waveform = Inference.prepare_output(waveform, model_sampling_rate, audio, sampling_rate) - return waveform + return waveform @property def valid_monitor(self):