Automatic Speech Recognition
Safetensors
Chinese
whisper

fix: allow endpoint callers to select transcription language

#3
AImpower.org org
•
edited Sep 16

The endpoint previously ignored language parameters, and its inference comment incorrectly said Mandarin was forced. This change lets callers select a transcription language for cross-language benchmarking.

  • Accept parameters.language in JSON audio requests, such as "en" or "zh", and pass it to Whisper with task="transcribe".
  • Preserve existing generation behavior when language is omitted or null. Copy the generation configuration to keep each language override local to its request.
  • Correct the misleading comment, document request examples and defaults, and add six handler regression tests.

Example request:

{"inputs": "<base64-encoded audio>", "parameters": {"language": "en"}}

Validation: python -m unittest discover -s tests -v passed all 6 tests, covering request formats, defaults, malformed parameters, error propagation, and sequential request isolation. A separate local smoke test with a randomly initialized tiny Whisper model and this repository's generation configuration verified English code/name/token and Mandarin prompts, transcription task selection, invalid-language rejection, and unchanged shared configuration (Transformers 4.57.3, PyTorch 2.9.1 CPU). Diff whitespace checks passed. Uploaded files were verified against the tested local files.

Full model weights and the deployed endpoint were not exercised; these checks do not establish English transcription quality. After review and merge, redeploy the endpoint and smoke-test English, Mandarin, and an omitted-language request. Model weights, saved generation configuration, and dependencies are unchanged.

gpric024 changed pull request status to open
AImpower.org org

Thanks Greg! The changes look good, merging it now.

shaomei changed pull request status to merged

Sign up or log in to comment