plan-write-revise
plan-write-revise copied to clipboard
RuntimeError: shape '[4000000, 1]' is invalid for input of size 4000 When running title-storyline to story model of plan and write
Hi,
I am trying to train a title-storyline to story model of plan and write paper using this command:
python pytorch_src/main.py --batch_size 20 --train-data rocstory_plan_write/ROCStories_all_merge_tokenize.titlesepkeysepstory.train --valid-data rocstory_plan_write/ROCStories_all_merge_tokenize.titlesepkeysepstory.dev --test-data rocstory_plan_write/ROCStories_all_merge_tokenize.titlesepkeysepstory.test --dropouti 0.4 --dropouth 0.25 --seed 141 --epoch 500 --emsize 1000 --nhid 1000 --save model.pt --vocab-file vocab.pkl
and I am getting this error:
Producing dataset...
Saved dictionary to vocab.pkl
Applying weight drop of 0.5 to weight_hh_l0
Applying weight drop of 0.5 to weight_hh_l0
Applying weight drop of 0.5 to weight_hh_l0
[WeightDrop(
(module): LSTM(1000, 1000)
), WeightDrop(
(module): LSTM(1000, 1000)
), WeightDrop(
(module): LSTM(1000, 1000)
)]
Using []
Args: Namespace(alpha=2, batch_size=20, beta=1, bptt=70, clip=0.25, cuda=True, dropout=0.4, dropoute=0.1, dropouth=0.25, dropouti=0.4, emsize=1000, epochs=50, log_interval=200, lr=30, model='LSTM', nhid=1000, nlayers=3, nonmono=5, optimizer='sgd', resume='', save='model.pt', seed=141, test_data='rocstory_plan_write/ROCStories_all_merge_tokenize.titlesepkeysepstory.test', tied=True, train_data='rocstory_plan_write/ROCStories_all_merge_tokenize.titlesepkeysepstory.train', valid_data='rocstory_plan_write/ROCStories_all_merge_tokenize.titlesepkeysepstory.dev', vocab_file='vocab.pkl', wdecay=1.2e-06, wdrop=0.5, when=[-1])
Model total parameters: 61965904
/home/anaconda3/envs/py36/lib/python3.6/site-packages/torch/nn/modules/rnn.py:179: RuntimeWarning: RNN module weights are not part of single contiguous chunk of memory. This means they need to be compacted at every call, possibly greatly increasing memory usage. To compact weights again call flatten_parameters().
self.dropout, self.training, self.bidirectional, self.batch_first)
Traceback (most recent call last):
File "pytorch_src/main.py", line 252, in <module>
train()
File "pytorch_src/main.py", line 208, in train
output, hidden, rnn_hs, dropped_rnn_hs = model(data, hidden, return_h=True)
File "/home/anaconda3/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in __call__
result = self.forward(*input, **kwargs)
File "/home/language-model/pytorch_src/model.py", line 82, in forward
raw_output, new_h = rnn(raw_output, hidden[l])
File "/home/anaconda3/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in __call__
result = self.forward(*input, **kwargs)
File "/home/language-model/pytorch_src/weight_drop.py", line 47, in forward
return self.module.forward(*args)
File "/home/anaconda3/envs/py36/lib/python3.6/site-packages/torch/nn/modules/rnn.py", line 179, in forward
self.dropout, self.training, self.bidirectional, self.batch_first)
RuntimeError: shape '[4000000, 1]' is invalid for input of size 4000
I wonder if you have any idea of what is wrong?
Thanks.