快捷方式

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[原始碼]

構建一個 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)。

返回:

解碼器

返回型別:

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 Decoder 進行 ASR 推斷

使用 CUDA CTC Decoder 進行 ASR 推斷

文件

查閱 PyTorch 的完整開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲取問題解答

檢視資源