快捷方式

cuda_ctc_decoder

torchaudio.models.decoder.cuda_ctc_decoder(tokens: Union[str, List[str]], nbest: int = 1, beam_size: int = 10, blank_skip_threshold: float = 0.95) CUCTCDecoder[source]

构建 CUCTCDecoder 的实例。

参数:
  • tokens (strList[str]) – 包含有效 tokens 的文件或列表。如果使用文件,预期的格式是将映射到相同索引的 tokens 放在同一行

  • beam_size (int, optional) – 每次解码步骤后要保留的最大假设数 (默认值:10)

  • nbest (int) – 要返回的最佳解码数

  • blank_id (int) – 与空白符号对应的 token ID。

  • blank_skip_threshold (float) – 如果 log_prob(blank) > log(blank_skip_threshold),则跳过帧以加速解码 (默认值:0.95)。

返回:

decoder

返回类型:

CUCTCDecoder

示例
>>> decoder = cuda_ctc_decoder(
>>>     vocab_file="tokens.txt",
>>>     blank_skip_threshold=0.95,
>>> )
>>> results = decoder(log_probs, encoder_out_lens) # List of shape (B, nbest) of Hypotheses
使用 cuda_ctc_decoder 的教程
ASR Inference with CUDA CTC Decoder

使用 CUDA CTC 解码器的 ASR 推理

使用 CUDA CTC 解码器的 ASR 推理

文档

访问 PyTorch 的全面开发者文档

查看文档

教程

获取面向初学者和高级开发者的深入教程

查看教程

资源

查找开发资源并获得解答

查看资源