String object has no suffix
Closed this issue · 1 comments
lars76 commented
☑️ Checks
- I have searched existing/past issues and found no similar issue.
✏️ 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
- python inference.py --input_dir t --out_path file.csv --predict_dataset somos
Additional notes
No response
kAIto47802 commented
Thank you for reporting the bug. I'll fix it.