hpzhao / SummaRuNNer

The PyTorch Implementation of SummaRuNNer
https://arxiv.org/pdf/1611.04230.pdf
MIT License
253 stars 81 forks source link

TypeError: slice indices must be integers or None or have an __index__ method #14

Closed SeekPoint closed 6 years ago

SeekPoint commented 6 years ago

mldl@mldlUB1604:~/ub16_prj/SummaRuNNer$ python main.py 2018-03-20 04:11:24,567 [INFO] Loading vocab,train and val dataset.Wait a second,please RNN ( (abs_pos_embed): Embedding(100, 50) (rel_pos_embed): Embedding(10, 50) (embed): Embedding(151332, 100, padding_idx=0) (word_RNN): GRU(100, 200, batch_first=True, bidirectional=True) (sent_RNN): GRU(400, 200, batch_first=True, bidirectional=True) (fc): Linear (400 -> 400) (content): Linear (400 -> 1) (salience): Bilinear (in1_features=400, in2_features=400, out_features=1) (novelty): Bilinear (in1_features=400, in2_features=400, out_features=1) (abs_pos): Linear (50 -> 1) (rel_pos): Linear (50 -> 1) )

Params: 16.7M

Traceback (most recent call last): File "main.py", line 171, in train() File "main.py", line 106, in train probs = net(features,doc_lens) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 206, in call result = self.forward(*input, **kwargs) File "/home/mldl/ub16_prj/SummaRuNNer/models/RNN.py", line 76, in forward word_out = self.max_pool1d(x,sent_lens) File "/home/mldl/ub16_prj/SummaRuNNer/models/RNN.py", line 53, in max_pool1d t = t[:seq_lens[index],:] File "/usr/local/lib/python2.7/dist-packages/torch/autograd/variable.py", line 69, in getitem return Index(key)(self) File "/usr/local/lib/python2.7/dist-packages/torch/autograd/_functions/tensor.py", line 16, in forward result = i.index(self.index) TypeError: slice indices must be integers or None or have an index method mldl@mldlUB1604:~/ub16_prj/SummaRuNNer$

hpzhao commented 6 years ago

Try pytorch==0.3.0.post4 @loveJasmine

SeekPoint commented 6 years ago

it works