Nrgeup / controllable-text-attribute-transfer

Code for "Controllable Unsupervised Text Attribute Transfer via Editing Entangled Latent Representation" (NeurIPS 2019)
Apache License 2.0
128 stars 27 forks source link

model vs model2 #12

Open mirandrom opened 4 years ago

mirandrom commented 4 years ago

Hello! We are trying to reproduce your paper for the neurips reproducibility challenge. First off, thanks for taking the time to make a clean codebase and providing a clear way to reproduce your experiments!

However, there are a few things we are uncertain about and wanted to clarify. It seems like the methodology described in the paper uses features found only in model2.py (e.g. GRU on the intermediate encoder state). However, all your main.py scripts use model.py, and some of the code in model2.py seems incomplete, with various lines commented out leading to undeclared variables.

e.g. from method/mymodel-amazon/model2.py in class EncoderDecoder (line 287):

    def forward(self, src, tgt, src_mask, tgt_mask):
        """
        Take in and process masked src and target sequences.
        """
        memory = self.encode(src, src_mask)  # (batch_size, max_src_seq, d_model)
        # attented_mem=self.attention(memory,memory,memory,src_mask)
        # memory=attented_mem
        score = self.attention(memory, memory, src_mask)
        attent_memory = score.bmm(memory)
        # memory=self.linear(torch.cat([memory,attent_memory],dim=-1))

        memory, _ = self.gru(attented_mem)
        '''
        score=torch.sigmoid(self.linear(memory))
        memory=memory*score
        '''
        latent = torch.sum(memory, dim=1)  # (batch_size, d_model)
        logit = self.decode(latent.unsqueeze(1), tgt, tgt_mask)  # (batch_size, max_tgt_seq, d_model)
        # logit,_=self.gru_decoder(logit)
        prob = self.generator(logit)  # (batch_size, max_seq, vocab_size)
        return latent, prob

Can you please advise us on the best way to reproduce your experiments? Should we run the code as is with model.py; or should we update the code to use model2.py (if so, what modifications need to be made?).

Thank you!

Nrgeup commented 4 years ago

Sorry to reply to you so late, you can use model.py to reproduce the result. We will update model2.py, and the results are not much improved compared to model.py.

Diego999 commented 4 years ago

@Nrgeup what about results in https://arxiv.org/pdf/1905.12926.pdf ? In the paper you clearly mention GRU. Results are reproducible without ?

Thank you for your answer