    def __init__(
        self,
        models,
        tgt_dict,
        tgt_dict_mt,
        beam_size=1,
        beam_size_mt=1,
        max_len_a=0,
        max_len_b=200,
        max_len_a_mt=0,
        max_len_b_mt=200,
        max_len=0,
        min_len=1,
        normalize_scores=True,
        len_penalty=1.0,
        len_penalty_mt=1.0,
        unk_penalty=0.0,
        temperature=1.0,
        match_source_len=False,
        no_repeat_ngram_size=0,
        eos=None,
        eos_mt=None,
        symbols_to_strip_from_output=None,
        lm_model=None,
        lm_weight=1.0,
    ):
        """Generates translations of a given source sentence.

        Args:
            models (List[~fairseq.models.FairseqModel]): ensemble of models,
                currently support fairseq.models.TransformerModel for scripting
            beam_size (int, optional): beam width (default: 1)
            max_len_a/b (int, optional): generate sequences of maximum length
                ax + b, where x is the source length for the second pass
            max_len_a_mt/b_mt (int, optional): generate sequences of maximum length
                ax + b, where x is the source length for the first pass
            max_len (int, optional): the maximum length of the generated output
                (not including end-of-sentence)
            min_len (int, optional): the minimum length of the generated output
                (not including end-of-sentence)
            normalize_scores (bool, optional): normalize scores by the length
                of the output (default: True)
            len_penalty (float, optional): length penalty in the second pass, where <1.0 favors
                shorter, >1.0 favors longer sentences (default: 1.0)
            len_penalty (float, optional): length penalty in the first pass, where <1.0 favors
                shorter, >1.0 favors longer sentences (default: 1.0)
            unk_penalty (float, optional): unknown word penalty, where <0
                produces more unks, >0 produces fewer (default: 0.0)
            temperature (float, optional): temperature, where values
                >1.0 produce more uniform samples and values <1.0 produce
                sharper samples (default: 1.0)
            match_source_len (bool, optional): outputs should match the source
                length (default: False)
        """
        super().__init__()

        from examples.speech_to_speech.unity.sequence_generator import SequenceGenerator

        self.generator = SequenceGenerator(
            models,
            tgt_dict,
            beam_size=beam_size,
            max_len_a=max_len_a,
            max_len_b=max_len_b,
            max_len=max_len,
            min_len=min_len,
            normalize_scores=normalize_scores,
            len_penalty=len_penalty,
            unk_penalty=unk_penalty,
            temperature=temperature,
            match_source_len=match_source_len,
            no_repeat_ngram_size=no_repeat_ngram_size,
            search_strategy=search.BeamSearch(tgt_dict),
            eos=eos,
            symbols_to_strip_from_output=symbols_to_strip_from_output,
            lm_model=lm_model,
            lm_weight=lm_weight,
        )
        self.eos = self.generator.eos

        self.generator_mt = SequenceGenerator(
            models,
            tgt_dict_mt,
            beam_size=beam_size_mt,
            max_len_a=max_len_a_mt,
            max_len_b=max_len_b_mt,
            max_len=max_len,
            min_len=min_len,
            normalize_scores=normalize_scores,
            len_penalty=len_penalty_mt,
            unk_penalty=unk_penalty,
            temperature=temperature,
            match_source_len=match_source_len,
            no_repeat_ngram_size=no_repeat_ngram_size,
            search_strategy=search.BeamSearch(tgt_dict_mt),
            eos=eos_mt,
            symbols_to_strip_from_output=symbols_to_strip_from_output,
        )
Generates translations of a given source sentence.

Args:
models (List[~fairseq.models.FairseqModel]): ensemble of models,
currently support fairseq.models.TransformerModel for scripting
beam_size (int, optional): beam width (default: 1)
max_len_a/b (int, optional): generate sequences of maximum length
ax + b, where x is the source length for the second pass
max_len_a_mt/b_mt (int, optional): generate sequences of maximum length
ax + b, where x is the source length for the first pass
max_len (int, optional): the maximum length of the generated output
(not including end-of-sentence)
min_len (int, optional): the minimum length of the generated output
(not including end-of-sentence)
normalize_scores (bool, optional): normalize scores by the length
of the output (default: True)
len_penalty (float, optional): length penalty in the second pass, where <1.0 favors
shorter, >1.0 favors longer sentences (default: 1.0)
len_penalty (float, optional): length penalty in the first pass, where <1.0 favors
shorter, >1.0 favors longer sentences (default: 1.0)
unk_penalty (float, optional): unknown word penalty, where <0
produces more unks, >0 produces fewer (default: 0.0)
temperature (float, optional): temperature, where values
>1.0 produce more uniform samples and values <1.0 produce
sharper samples (default: 1.0)
match_source_len (bool, optional): outputs should match the source
length (default: False)
examples/speech_to_speech/unity/sequence_generator_multi_decoder.py