Commit c39ff39
authored
feat(fun_asr_nano): batched VAD-segment decoding (~1.75x faster) (#2979)
* feat(fun_asr_nano): batched VAD-segment decoding (1.6x faster, lower CER)
Fun-ASR-Nano inference raised `NotImplementedError("batch decoding is not
implemented")` for more than one input, so `AutoModel.generate(..., batch_size_s=...)`
processed VAD segments one at a time (batch_size=1). For the small Qwen3-0.6B
decoder this badly underutilizes the GPU.
This adds `_inference_llm_batch`: build each segment's `inputs_embeds` via the
existing single-sample `inference_prepare`, left-pad them into one batch (with
attention mask + position_ids), and run a single `llm.generate`. `inference_llm`
routes multi-segment input there. The single-segment path is unchanged.
Benchmark (Fun-ASR-Nano-2512, 184 Chinese files / 11,539 s, H100, same VAD):
- batch_size=1 (before): RTFx 19.8, CER 10.74%
- batch_size_s=120 (this PR): RTFx 31.8, CER 9.23% (avg of repeated runs)
~1.6x faster AND slightly lower CER (batched batch_decode also handles a
special-token edge case that errored a few files in the per-segment path).
CTC timestamps are not produced in batched mode; use the single-segment path
when timestamps are needed.
* feat(fun_asr_nano): batched VAD-segment decoding
Batch multiple VAD segments into one llm.generate (left-padding +
attention_mask + position_ids) for much better GPU utilization of the
small LLM decoder. Auto-activates for multi-segment input, but only when
no CTC decoder is loaded, so timestamp behavior is preserved.
Tested: faster decoding with equal/better CER on the benchmark set.
---------
Co-authored-by: LauraGPT <LauraGPT@users.noreply.github.com>1 parent 8107365 commit c39ff39
1 file changed
Lines changed: 84 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
721 | 798 | | |
722 | 799 | | |
723 | 800 | | |
| |||
737 | 814 | | |
738 | 815 | | |
739 | 816 | | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
740 | 824 | | |
741 | 825 | | |
742 | 826 | | |
| |||
0 commit comments