GBLin5566 / toward-controlled-generation-of-text-pytorch

A PyTorch Implementation of "Toward Controlled Generation of Text"
MIT License
104 stars 23 forks source link

Not enough memory #1

Open Crazylove274 opened 7 years ago

Crazylove274 commented 7 years ago

The following problem is encountered when running your code:

Traceback (most recent call last):
  File "/home/syrup274/toward-controlled-generation-of-text-pytorch-master/train.py", line 113, in <module>
    train_discriminator(discriminator)
  File "/home/syrup274/toward-controlled-generation-of-text-pytorch-master/train.py", line 107, in train_discriminator
    _, predicted = torch.max(discriminator(input_data).data, 1)
  File "/home/syrup274/.local/lib/python3.5/site-packages/torch/nn/modules/module.py", line 206, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/syrup274/toward-controlled-generation-of-text-pytorch-master/Model/Modules.py", line 164, in forward
    emb_sentence = self.src_word_emb(input_sentence)
  File "/home/syrup274/.local/lib/python3.5/site-packages/torch/nn/modules/module.py", line 206, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/syrup274/.local/lib/python3.5/site-packages/torch/nn/modules/sparse.py", line 94, in forward
    )(input, self.weight)
  File "/home/syrup274/.local/lib/python3.5/site-packages/torch/nn/_functions/thnn/sparse.py", line 53, in forward
    output = torch.index_select(weight, 0, indices.view(-1))
RuntimeError: $ Torch: not enough memory: you tried to allocate 13GB. Buy new RAM! at /b/wheel/pytorch-src/torch/lib/TH/THGeneral.c:270
GBLin5566 commented 7 years ago

Hi @Crazylove274 , I would work on making a better interface to adjust the parameters. By far, you could change the CNN filter size and kernel size in Discriminator down to run the code. Thanks for the interests.