缓存感知的流会跳过比采样帧短的最后一块数据,因此流的最后一字取决于其批次。
作者: kzos创建于 2026年9月28日更新于 2026年9月28日
标签community-requestwaiting-on-customer
描述错误
CacheAwareStreamingAudioBuffer 一旦下一个块比预编码器的 sampling_frames 窄,就停止迭代。检查位于 __iter__ (L1629-L1639) 和 _iter_with_right_context (L1827-L1837) 中复制的位置:
audio_chunk = self.buffer[:, :, self.buffer_idx : self.buffer_idx + chunk_size]
if self.sampling_frames is not None:
# checking to make sure the audio chunk has enough frames to produce at least one output after
# downsampling
...
if audio_chunk.size(-1) < cur_sampling_frames:
return这里出现了两个问题:
self.buffer经过零填充以使批量中最长的流变长(append_processed_signal,L1950 和 L1957)。因此,audio_chunk.size(-1)表示 最长 流的剩余宽度,并针对整个批量做出了一个决策。- 检查只计算新帧。该块随后与预编码缓存一起传入,因此短尾仍然产生输出。使用 FastConformer 流式设置(
dw_striding,子采样系数 8,causal_downsampling: true),9 帧的缓存加上 1-7 帧的尾部,在drop_extra_pre_encoded=2后留下 1 个编码器帧。离线向前传递也会生成该帧。
内容来源: NVIDIA-NeMo/Speech