Skip to content

fix(inference): inference crashes on non-audio files in (+1 more) - #18

Open
andrewwhitecdw wants to merge 1 commit into
NVIDIA:mainfrom
andrewwhitecdw:bugfix/inference-assorted-5c4edad6
Open

fix(inference): inference crashes on non-audio files in (+1 more)#18
andrewwhitecdw wants to merge 1 commit into
NVIDIA:mainfrom
andrewwhitecdw:bugfix/inference-assorted-5c4edad6

Conversation

@andrewwhitecdw

@andrewwhitecdw andrewwhitecdw commented Jul 27, 2026

Copy link
Copy Markdown

This PR addresses 2 issues in inference.py.

Fix 1

fix: inference crashes on non-audio files in input directory

Fix: Replace:

    filelist = os.listdir(a.input_wavs_dir)

with:

    filelist = [
        f
        for f in os.listdir(a.input_wavs_dir)
        if f.lower().endswith((".wav", ".flac", ".mp3"))
    ]

Fix 2

fix: int16 cast can wrap around at full scale

Fix: Replace:

            audio = audio * MAX_WAV_VALUE
            audio = audio.cpu().numpy().astype("int16")

with:

            audio = audio * MAX_WAV_VALUE
            audio = audio.clamp(min=-MAX_WAV_VALUE, max=MAX_WAV_VALUE - 1)
            audio = audio.cpu().numpy().astype("int16")

Files changed

  • inference.py

@andrewwhitecdw
andrewwhitecdw marked this pull request as ready for review July 28, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant