mirror of
https://github.com/modelscope/FunASR.git
synced 2026-10-12 02:19:18 +00:00
The Fun-ASR-Nano vLLM serving paths run with enable_prompt_embeds=True, so requests carry audio/text embeddings and have no prompt token IDs. vLLM applies repetition_penalty by scattering over the prompt token IDs, so any value other than 1.0 indexes an empty tensor and aborts the engine with a CUDA "scatter gather index out of bounds" assertion (issue #2948). The batch generate() entry already defaulted to 1.0, but the OpenAI/REST server (_server_app), the pipeline path and the streaming path still hardcoded repetition_penalty=1.3 and crashed. Centralize the rule in a dependency-free helper (resolve_repetition_penalty) that forces the neutral value in prompt-embeds mode and warns once, and route every Fun-ASR-Nano SamplingParams through it. The pipeline and streaming paths now also honor a caller-supplied repetition_penalty (sanitized) instead of ignoring it. Adds tests/test_fun_asr_nano_repetition_penalty.py (no GPU or vLLM required).