8a1c113df6403b0aae6d951fec8624643953e018,mozilla_voice_tts/tts/models/tacotron.py,Tacotron,__init__,#Tacotron#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#,10

Before Change


                               prenet_type, prenet_dropout, forward_attn,
                               trans_agent, forward_attn_mask, location_attn,
                               attn_K, separate_stopnet, proj_speaker_dim)
        self.postnet = PostCBHG(decoder_output_dim)
        self.last_linear = nn.Linear(self.postnet.cbhg.gru_features * 2,
                                     postnet_output_dim)
        // speaker embedding layers
        if num_speakers > 1:
            self.speaker_embedding = nn.Embedding(num_speakers, speaker_embedding_dim)
            self.speaker_embedding.weight.data.normal_(0, 0.3)
            self.speaker_project_mel = nn.Sequential(
                nn.Linear(speaker_embedding_dim, proj_speaker_dim), nn.Tanh())
            self.speaker_embeddings = None
            self.speaker_embeddings_projected = None
        // global style token layers
        if self.gst:
            self.gst_layer = GST(num_mel=80,
                                 num_heads=gst_num_heads,
                                 num_style_tokens=gst_style_tokens,
                                 embedding_dim=gst_embedding_dim)
        // backward pass decoder
        if self.bidirectional_decoder:
            self._init_backward_decoder()
        // setup DDC
        if self.double_decoder_consistency:
            self.coarse_decoder = Decoder(
                decoder_in_features, decoder_output_dim, ddc_r, memory_size,
                attn_type, attn_win, attn_norm, prenet_type, prenet_dropout,
                forward_attn, trans_agent, forward_attn_mask, location_attn,

After Change



class Tacotron(TacotronAbstract):
    def __init__(self,
                 num_chars,
                 num_speakers,
                 r=5,
                 postnet_output_dim=1025,
                 decoder_output_dim=80,
                 attn_type="original",
                 attn_win=False,
                 attn_norm="sigmoid",
                 prenet_type="original",
                 prenet_dropout=True,
                 forward_attn=False,
                 trans_agent=False,
                 forward_attn_mask=False,
                 location_attn=True,
                 attn_K=5,
                 separate_stopnet=True,
                 bidirectional_decoder=False,
                 double_decoder_consistency=False,
                 ddc_r=None,
                 speaker_embedding_dim=None,
                 gst=False,
                 gst_embedding_dim=256,
                 gst_num_heads=4,
                 gst_style_tokens=10,
                 memory_size=5):
        super(Tacotron,
              self).__init__(num_chars, num_speakers, r, postnet_output_dim,
                             decoder_output_dim, attn_type, attn_win,
                             attn_norm, prenet_type, prenet_dropout,
                             forward_attn, trans_agent, forward_attn_mask,
                             location_attn, attn_K, separate_stopnet,
                             bidirectional_decoder, double_decoder_consistency,
                             ddc_r, gst)

        // init layer dims
        decoder_in_features = 256
        encoder_in_features = 256

        if speaker_embedding_dim is None:
            // if speaker_embedding_dim is None we need use the nn.Embedding, with default speaker_embedding_dim
            self.embeddings_per_sample = False
            speaker_embedding_dim = 256
        else:
            // if speaker_embedding_dim is not None we need use speaker embedding per sample
            self.embeddings_per_sample = True

        // speaker and gst embeddings is concat in decoder input
        if num_speakers > 1: 
            decoder_in_features = decoder_in_features + speaker_embedding_dim // add speaker embedding dim
        if self.gst:
            decoder_in_features = decoder_in_features + gst_embedding_dim // add gst embedding dim

        // embedding layer
        self.embedding = nn.Embedding(num_chars, 256, padding_idx=0)

        // speaker embedding layers
        if num_speakers > 1:
            if not self.embeddings_per_sample:
                self.speaker_embedding = nn.Embedding(num_speakers, speaker_embedding_dim)
                self.speaker_embedding.weight.data.normal_(0, 0.3)

        // base model layers
        self.embedding.weight.data.normal_(0, 0.3)
        self.encoder = Encoder(encoder_in_features)
        self.decoder = Decoder(decoder_in_features, decoder_output_dim, r,
                               memory_size, attn_type, attn_win, attn_norm,
                               prenet_type, prenet_dropout, forward_attn,
                               trans_agent, forward_attn_mask, location_attn,
                               attn_K, separate_stopnet)
        self.postnet = PostCBHG(decoder_output_dim)
        self.last_linear = nn.Linear(self.postnet.cbhg.gru_features * 2,
                                     postnet_output_dim)

        // global style token layers
        if self.gst:
            self.gst_layer = GST(num_mel=80,
                                 num_heads=gst_num_heads,
                                 num_style_tokens=gst_style_tokens,
                                 embedding_dim=gst_embedding_dim)
        // backward pass decoder
        if self.bidirectional_decoder:
            self._init_backward_decoder()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 12

Instances


Project Name: mozilla/TTS
Commit Name: 8a1c113df6403b0aae6d951fec8624643953e018
Time: 2020-08-05
Author: edresson1@gmail.com
File Name: mozilla_voice_tts/tts/models/tacotron.py
Class Name: Tacotron
Method Name: __init__


Project Name: mozilla/TTS
Commit Name: 8a1c113df6403b0aae6d951fec8624643953e018
Time: 2020-08-05
Author: edresson1@gmail.com
File Name: mozilla_voice_tts/tts/models/tacotron.py
Class Name: Tacotron
Method Name: __init__


Project Name: mozilla/TTS
Commit Name: 0a92c6d5a7601fe0b1d8d5bf53ef1774c15647cc
Time: 2019-03-25
Author: egolge@mozilla.com
File Name: models/tacotron.py
Class Name: Tacotron
Method Name: __init__


Project Name: ikostrikov/pytorch-a2c-ppo-acktr
Commit Name: 18022693482182082f178cd73fa3a3cfdecc160a
Time: 2018-05-02
Author: ikostrikov@gmail.com
File Name: model.py
Class Name: MLPBase
Method Name: __init__