| | |
| | | batch_size_token=5000, batch_size_token_threshold_s=40, max_single_segment_time=6000) |
| | | print(rec_result) |
| | | ``` |
| | | |
| | | Where, |
| | | - `batch_size_token` refs to dynamic batch_size and the total tokens of batch is `batch_size_token`, 1 token = 60 ms. |
| | | - `batch_size_token_threshold_s`: The batch_size is set to 1, when the audio duration exceeds the threshold value of `batch_size_token_threshold_s`, specified in `s`. |
| | | - `max_single_segment_time`: The maximum length for audio segmentation in VAD, specified in `ms`. |
| | | |
| | | Suggestion: When encountering OOM (Out of Memory) issues with long audio inputs, as the GPU memory usage increases with the square of the audio duration, there are three possible scenarios: |
| | | |
| | | a) In the initial inference stage, GPU memory usage primarily depends on `batch_size_token`. Reducing this value appropriately can help reduce memory usage. |
| | |
| | | - `batch_size_token` 表示采用动态batch,batch中总token数为 `batch_size_token`,1 token = 60 ms. |
| | | - `batch_size_token_threshold_s`: 表示音频时长超过 `batch_size_token_threshold_s`阈值是,batch数设置为1, 单位为s. |
| | | - `max_single_segment_time`: 表示VAD最大切割音频时长, 单位是ms. |
| | | |
| | | 建议:当您输入为长音频,遇到OOM问题时,因为显存占用与音频时长呈平方关系增加,分为3种情况: |
| | | - a)推理起始阶段,显存主要取决于`batch_size_token`,适当减小该值,可以减少显存占用; |
| | | - b)推理中间阶段,遇到VAD切割的长音频片段,总token数小于`batch_size_token`,仍然出现OOM,可以适当减小`batch_size_token_threshold_s`,超过阈值,强制batch为1; |