Exemplo n.º 1
0
    def __init__(self, features, latent_dim, encoder, decoder, deterministic_path_drop_rate=0.5):
        
        super().__init__()

        self.embedder = nn.Embedding(MAX_VALUE, features)
        self.encoder = ResidualAttentionEncoder(**encoder)
        self._latent_encoder = nn.ModuleList([
            ResidualAttentionEncoder(**encoder),
            NormalNode(features, latent_dim)]
        )
        self.z_to_c = nn.Linear(latent_dim, latent_dim*155)
        self.decoder = CondtionalResidualAttentionEncoder(**decoder)
        self.logits = FeedForwardGELU(features, MAX_VALUE)
        self.drop = nn.Dropout(deterministic_path_drop_rate)
Exemplo n.º 2
0
    def __init__(self, features, encoder):
        
        super().__init__()

        self.embedder = nn.Embedding(MAX_VALUE, features)
        self.encoder = ResidualAttentionEncoder(**encoder)

        self.logits = nn.Linear(features, MAX_VALUE)
Exemplo n.º 3
0
    def __init__(self,
                 features,
                 latent_dim,
                 encoder,
                 decoder,
                 deterministic_path_drop_rate=0.5,
                 num_flows=3):

        super().__init__()

        self.embedder = nn.Embedding(MAX_VALUE, features)
        self.encoder = ResidualAttentionEncoder(**encoder)
        self._latent_encoder = nn.ModuleList([
            ResidualAttentionEncoder(**encoder),
            TriangularSylvesterFlow(features, latent_dim, num_flows)
        ])
        self.z_to_c = nn.Linear(latent_dim, latent_dim * 155)
        self.decoder = CondtionalResidualAttentionEncoder(**decoder)
        self.logits = FeedForwardGELU(features, MAX_VALUE)

        self.drop = nn.Dropout(deterministic_path_drop_rate)
        self.n_features = features
Exemplo n.º 4
0
    def __init__(self, features, latent_dim, encoder, decoder, num_flows=3):
        """
        features - number of features in the model
        latent_dim - the latent dimension of the model
        encoder - dictionary containing instantiation parameters for ResidualAttentionEncoder module
        decoder - dictionary containing instantiation parameters for CondtionalResidualAttentionEncoder module
        num_flows - the number of flows for the TriangularSylvesterFlow module
        """

        super().__init__()

        self.embedder = nn.Embedding(MAX_VALUE, features)
        self.encoder = ResidualAttentionEncoder(**encoder)
        self._latent_encoder = nn.ModuleList([
            ResidualAttentionEncoder(**encoder),
            TriangularSylvesterFlow(features, latent_dim, num_flows)
        ])
        self.z_to_c = nn.Linear(latent_dim, latent_dim * 155)
        self.decoder = CondtionalResidualAttentionEncoder(**decoder)
        self.logits = FeedForwardGELU(features, MAX_VALUE)

        self.n_features = features