sarulab-speech/UTMOSv2

String object has no suffix

Closed this issue · 1 comments

☑️ Checks

✏️ Description

UTMOSv2/utmosv2/dataset/_utils.py", line 8, in load_audio
if file.suffix == ".wav":
^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'suffix'

Environment

Just a clean Python environment (3.11)

Expected behavior

Expected behavior: no error. This works for me to fix it:

def load_audio(cfg, file: str) -> np.ndarray:
    file = Path(file)
    if file.suffix == ".wav":
        y, sr = librosa.load(file, sr=None)
        y = librosa.resample(y, orig_sr=sr, target_sr=cfg.sr)
    else:
        y = np.load(file)
    return y

Steps to reproduce

  1. python inference.py --input_dir t --out_path file.csv --predict_dataset somos

Additional notes

No response

Thank you for reporting the bug. I'll fix it.