Fun-ASR icon indicating copy to clipboard operation
Fun-ASR copied to clipboard

[Bug] Native CLI can consume the local filename as a keyword and select the default sample

Open LauraGPT opened this issue 2 months ago • 1 comments

Observed input-selection problem

On current main 0339018ba74a7defa3b6b6a96718d17b816be77b, the native Transformers CLI can select the bundled English sample instead of an explicitly supplied local recording when keyword options precede the filename:

python examples/transformers/transcribe.py --keywords OpenAI recording.wav

--keywords uses nargs="*", so argparse consumes both OpenAI and recording.wav as keywords. The positional audio list is empty, and main() enters its default example/en.mp3 download path. This can make a user evaluate the wrong input and trigger an unintended sample/model download. The README's file-first commands are unaffected.

Reproduction and controls

Using a valid, synthetic one-second mono 16 kHz WAV:

Arguments after the script Actual selected input boundary
recording.wav --keywords OpenAI Local WAV, decoded to 16000 samples
--keywords OpenAI recording.wav Default pinned example/en.mp3 downloader
--keywords OpenAI -- recording.wav Local WAV, decoded to 16000 samples
--prompt test recording.wav Local WAV, decoded to 16000 samples

The probe executed the current script's real main(), argparse and CPU runtime validation. It intercepted huggingface_hub.hf_hub_download to record its requested repository/file/revision and stop before downloading; the three controls executed the real local audio decoder and stopped before processor/model loading. Thus this verifies wrong input selection, not a completed wrong transcript. No model weights, network downloads, GPU or inference were used. Script SHA256: ba75c4bf8ee080650efc11e1403583c093882f5ad813e8e26be98923fac0e54a.

Immediate workaround

Put recordings before the variable-length options, as documented, or use -- to terminate options:

python examples/transformers/transcribe.py recording.wav --keywords OpenAI
python examples/transformers/transcribe.py --keywords OpenAI -- recording.wav

Proposed acceptance criteria

Prevent ambiguous keyword-only parsing from silently choosing the official sample. A clear usage error before any download is preferable to guessing which keyword is a filename. Preserve the ordinary no-argument sample demo and documented file-first multi-keyword/batch usage. Add CLI-level tests for the four input-selection cases above, including a downloader-not-called assertion for the rejected ambiguous case. The precise CLI compatibility policy still needs design approval; no implementation is included here.

LauraGPT avatar Sep 13 '26 04:09 LauraGPT

--keywords uses nargs="*", so argparse can consume both the keywords and the trailing filename. The resulting empty audio list triggers the sample download.

When the audio list is empty, the CLI rejects any keyword containing a path separator or ending in a recognized audio suffix, ignoring case for the suffix check. The usage error appears before any download and explains how to disambiguate the filename.

https://github.com/QwenAudio/Fun-ASR/pull/180

mvanhorn avatar Nov 20 '26 09:11 mvanhorn