paddlespeech.s2t.models.st_interface module
ST Interface module.
- class paddlespeech.s2t.models.st_interface.STInterface[source]
Bases:
ASRInterface
ST Interface model implementation.
NOTE: This class is inherited from ASRInterface to enable joint translation and recognition when performing multi-task learning with the ASR task.
- Attributes:
attention_plot_class
Get attention plot class.
ctc_plot_class
Get CTC plot class.
Methods
add_arguments
(parser)Add arguments to parser.
build
(idim, odim, **kwargs)Initialize this class with python-level args.
calculate_all_attentions
(xs, ilens, ys)Calculate attention.
calculate_all_ctc_probs
(xs, ilens, ys)Calculate CTC probability.
encode
(feat)Encode feature in beam_search (optional).
forward
(xs, ilens, ys, olens)Compute loss for training.
get_total_subsampling_factor
()Get total subsampling factor.
recognize
(x, recog_args[, char_list, rnnlm])Recognize x for evaluation.
recognize_batch
(x, recog_args[, char_list, ...])Beam search implementation for batch.
scorers
()Get scorers for beam_search (optional).
translate
(x, trans_args[, char_list, rnnlm, ...])Recognize x for evaluation.
translate_batch
(x, trans_args[, char_list, ...])Beam search implementation for batch.
- translate(x, trans_args, char_list=None, rnnlm=None, ensemble_models=[])[source]
Recognize x for evaluation.
- Parameters:
x (ndarray) -- input acouctic feature (B, T, D) or (T, D)
trans_args (namespace) -- argment namespace contraining options
char_list (list) -- list of characters
rnnlm (paddle.nn.Layer) -- language model module
- Returns:
N-best decoding results
- Return type:
list
- translate_batch(x, trans_args, char_list=None, rnnlm=None)[source]
Beam search implementation for batch.
- Parameters:
x (paddle.Tensor) -- encoder hidden state sequences (B, Tmax, Henc)
trans_args (namespace) -- argument namespace containing options
char_list (list) -- list of characters
rnnlm (paddle.nn.Layer) -- language model module
- Returns:
N-best decoding results
- Return type:
list