#16247·Speech

早期中断增强可能会完全删除重新定位的 EOS 令牌

作者: udsy19创建于 2026年9月12日更新于 2026年9月16日
标签community-request

描述错误

DuplexSTTDataset._apply_early_interruption_augmentation(nemo/collections/speechlm2/data/duplex_stt_dataset.py)通过将转换的EOS标记在序列中更早的位置上,然后填充被占用的尾部,模拟用户早期中断。它在计算尾部偏移之前,将新的EOS标记写入,然后无条件地用填充ID覆盖后面的frames_to_remove位置:

python
target_tokens[batch_idx, new_eos_pos] = eos_id
seq_len = target_tokens.shape[1]
cont_start_pos = original_eos_pos + overlap_tokens
tail_length = seq_len - (cont_start_pos + 1)
if tail_length > 0:
    target_tokens[batch_idx, new_eos_pos + 1 : new_eos_pos + 1 + tail_length] = target_tokens[
        batch_idx, cont_start_pos + 1 : cont_start_pos + 1 + tail_length
    ].clone()
target_tokens[batch_idx, -frames_to_remove:] = pad_id

当转换的原始EOS位置足够靠近序列的末尾,以至于不存在任何尾部偏移(cont_start_pos >= seq_len - 1),则最后的填充范围[-frames_to_remove:]new_eos_pos开始,立即覆盖刚写入的EOS标记 — 经过增强的转换最终没有任何EOS标记。

内容来源: NVIDIA-NeMo/Speech