diff --git a/wesep/bin/infer.py b/wesep/bin/infer.py index f5a58c5..f606717 100644 --- a/wesep/bin/infer.py +++ b/wesep/bin/infer.py @@ -59,11 +59,11 @@ def infer(config="confs/conf.yaml", **kwargs): if not os.path.exists(save_audio_dir): try: os.makedirs(save_audio_dir) - print(f"Directory '{save_audio_dir}' created successfully.") + print(f"Directory {save_audio_dir} created successfully.") except OSError as e: - print(f"Error creating directory '{save_audio_dir}': {e}") + print(f"Error creating directory {save_audio_dir}: {e}") else: - print(f"Directory '{save_audio_dir}' already exists.") + print(f"Directory {save_audio_dir} already exists.") else: print("Do NOT save the results in wav.") diff --git a/wesep/bin/score.py b/wesep/bin/score.py index 389073c..285c38b 100644 --- a/wesep/bin/score.py +++ b/wesep/bin/score.py @@ -52,12 +52,12 @@ def scoring( if not Path(dnsmos_args["primary_model"]).exists(): raise ValueError( - f"The primary model '{dnsmos_args['primary_model']}' doesn't exist." + f"The primary model {dnsmos_args['primary_model']} doesn't exist." " You can download the model from https://github.com/microsoft/" "DNS-Challenge/tree/master/DNSMOS/DNSMOS/sig_bak_ovr.onnx") if not Path(dnsmos_args["p808_model"]).exists(): raise ValueError( - f"The P808 model '{dnsmos_args['p808_model']}' doesn't exist." + f"The P808 model {dnsmos_args['p808_model']} doesn't exist." " You can download the model from https://github.com/microsoft/" "DNS-Challenge/tree/master/DNSMOS/DNSMOS/model_v8.onnx") dnsmos = DNSMOS_local( @@ -90,7 +90,7 @@ def scoring( logging.warning("Using the PESQ package for evaluation") except ImportError: raise ImportError( - "Please install pesq and retry: pip install pesq") + "Please install pesq and retry: pip install pesq") from None else: pesq = None diff --git a/wesep/modules/common/norm.py b/wesep/modules/common/norm.py index ce9b69e..1001719 100644 --- a/wesep/modules/common/norm.py +++ b/wesep/modules/common/norm.py @@ -83,7 +83,7 @@ def select_norm(norm, dim): class FiLM(nn.Module): """Feature-wise Linear Modulation (FiLM) layer - https://github.com/HuangZiliAndy/fairseq/blob/multispk/fairseq/models/wavlm/WavLM.py#L1160 + https://github.com/HuangZiliAndy/fairseq/blob/multispk/fairseq/models/wavlm/WavLM.py#L1160 # noqa """ def __init__(self, diff --git a/wesep/modules/tfgridnet/gridnet_block.py b/wesep/modules/tfgridnet/gridnet_block.py index 790dd42..af6ccf0 100644 --- a/wesep/modules/tfgridnet/gridnet_block.py +++ b/wesep/modules/tfgridnet/gridnet_block.py @@ -125,12 +125,10 @@ def forward(self, x): B, C, old_T, old_Q = x.shape olp = self.emb_ks - self.emb_hs - T = (math.ceil( - (old_T + 2 * olp - self.emb_ks) / self.emb_hs) * self.emb_hs + - self.emb_ks) - Q = (math.ceil( - (old_Q + 2 * olp - self.emb_ks) / self.emb_hs) * self.emb_hs + - self.emb_ks) + T = math.ceil((old_T + 2 * olp - self.emb_ks) / + self.emb_hs) * self.emb_hs + self.emb_ks + Q = math.ceil((old_Q + 2 * olp - self.emb_ks) / + self.emb_hs) * self.emb_hs + self.emb_ks x = x.permute(0, 2, 3, 1) # [B, old_T, old_Q, C] x = F.pad( diff --git a/wesep/utils/dnsmos.py b/wesep/utils/dnsmos.py index d1e33ec..528ae93 100644 --- a/wesep/utils/dnsmos.py +++ b/wesep/utils/dnsmos.py @@ -77,7 +77,7 @@ def __init__( from onnx2torch import convert except ModuleNotFoundError: raise RuntimeError( - "Please install onnx2torch manually and retry!") + "Please install onnx2torch manually and retry!") from None if primary_model_path is not None: self.primary_model = convert(primary_model_path).eval() @@ -99,7 +99,7 @@ def __init__( import onnxruntime as ort except ModuleNotFoundError: raise RuntimeError( - "Please install onnxruntime manually and retry!") + "Please install onnxruntime manually and retry!") from None prvd = ("CUDAExecutionProvider" if use_gpu else "CPUExecutionProvider") diff --git a/wesep/utils/file_utils.py b/wesep/utils/file_utils.py index 951ae30..f82e69b 100644 --- a/wesep/utils/file_utils.py +++ b/wesep/utils/file_utils.py @@ -203,7 +203,7 @@ def soundfile_read( if prev_wav is not None: if prev_rate != rate: raise RuntimeError( - f"'{prev_wav}' and '{wav}' have mismatched sampling rate: " + f"{prev_wav} and {wav} have mismatched sampling rate: " f"{prev_rate} != {rate}") dim1 = arrays[0].shape[1 - concat_axis]