eliorav / writing-style-transfer

writing style transfer using cycle gan
20 stars 6 forks source link

Google Colab notebook currently not working #2

Open pnmartinez opened 4 years ago

pnmartinez commented 4 years ago

Hello! First of all, thank you for the contribution!

The error

I was trying to see what the model comes up to, so I went for the Google Colab linked.

However, there may be a torchversion problem (just my hypothesis), as I am getting a dimension mismatch error while initializing the generators and discriminators** (the cells to "Prepare the networks"). See log below.

---------------------------------------------------------------------------

RuntimeError                              Traceback (most recent call last)

<ipython-input-15-a6589232276f> in <module>()
----> 1 g_ab, g_ba, d_a, d_b = get_cycle_gan_network(G_INPUT_DIM, G_OUTPUT_DIM, device, PAD_IDX, SOS_IDX, True, True)

2 frames

/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict)
    845         if len(error_msgs) > 0:
    846             raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
--> 847                                self.__class__.__name__, "\n\t".join(error_msgs)))
    848         return _IncompatibleKeys(missing_keys, unexpected_keys)
    849 

RuntimeError: Error(s) in loading state_dict for Seq2Seq:
    size mismatch for encoder.embedding.weight: copying a param with shape torch.Size([9887, 256]) from checkpoint, the shape in current model is torch.Size([9889, 256]).
    size mismatch for decoder.embedding.weight: copying a param with shape torch.Size([9887, 256]) from checkpoint, the shape in current model is torch.Size([9889, 256]).
    size mismatch for decoder.out.weight: copying a param with shape torch.Size([9887, 512]) from checkpoint, the shape in current model is torch.Size([9889, 512]).
    size mismatch for decoder.out.bias: copying a param with shape torch.Size([9887]) from checkpoint, the shape in current model is torch.Size([9889]).

Discussion

The Colab notebook should be updated in order for it to be useful. Do you have any idea what may be happening here? @eliorav

eliorav commented 4 years ago

Hi Pablo, we used the nltk English stopwords as a vocab for our model. it looks like that nltk increased their vocab size (it used to be 9887 words and now it includes 9889 words). in order to use our pre-train model, you should download the same vocab as we used (or probably removed the new stopwords). I probably will fix it in the following days. let me know if you need more help.

best, Elior

pnmartinez commented 4 years ago

Hello @eliorav !

I see you've closed the issue, but the Google Colab is yet having the same error.

I think we can keep the issue open until the Colab is properly updated, what do you think?

pnmartinez commented 4 years ago

Hello @eliorav,

I do need further help: can you point me to the nltk that you used? Thank you.