espnet2.asr.transducer.rnnt_multi_blank.rnnt.rnnt_loss_cpu
Less than 1 minute
espnet2.asr.transducer.rnnt_multi_blank.rnnt.rnnt_loss_cpu
espnet2.asr.transducer.rnnt_multi_blank.rnnt.rnnt_loss_cpu(acts: Tensor, labels: Tensor, input_lengths: Tensor, label_lengths: Tensor, costs: Tensor, grads: Tensor, blank_label: int, fastemit_lambda: float, clamp: float, num_threads: int)
Wrapper method for accessing CPU RNNT loss.
CPU implementation ported from [HawkAaron/warp-transducer] : (https://github.com/HawkAaron/warp-transducer).
- Parameters:
- acts – Activation tensor of shape [B, T, U, V+1].
- labels – Ground truth labels of shape [B, U].
- input_lengths – Lengths of the acoustic sequence as a vector of ints [B].
- label_lengths – Lengths of the target sequence as a vector of ints [B].
- costs – Zero vector of length [B] in which costs will be set.
- grads – Zero tensor of shape [B, T, U, V+1] where the gradient will be set.
- blank_label – Index of the blank token in the vocabulary.
- fastemit_lambda – Float scaling factor for FastEmit regularization. Refer to FastEmit: Low-latency Streaming ASR with Sequence-level Emission Regularization.
- clamp – Float value. When set to value >= 0.0, will clamp the gradient to [-clamp, clamp].
- num_threads – Number of threads for OpenMP.