Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String object has no suffix #1

Closed
1 task done
lars76 opened this issue Jul 28, 2024 · 1 comment · Fixed by #4
Closed
1 task done

String object has no suffix #1

lars76 opened this issue Jul 28, 2024 · 1 comment · Fixed by #4
Labels
bug Something isn't working
Milestone

Comments

@lars76
Copy link

lars76 commented Jul 28, 2024

☑️ 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

@lars76 lars76 added the bug Something isn't working label Jul 28, 2024
@kAIto47802
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants