schelotto / Neural_Speed_Reading_via_Skim-RNN_PyTorch

PyTorch implementation of "Neural Speed Reading via Skim-RNN"
MIT License
18 stars 9 forks source link

RuntimeError: size mismatch at /pytorch/torch/lib/THC/generic/THCTensorMathBlas.cu:243 #6

Open SeekPoint opened 6 years ago

SeekPoint commented 6 years ago

mldl@mldlUB1604:~/ub16_prj/Neural_Speed_Reading_via_Skim-RNN_PyTorch$ python3 main.py

Loading data... 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2196017/2196017 [04:09<00:00, 8804.83it/s]

Parameters: BATCH_SIZE=32 CUDA=True DEVICE=0 DROPOUT=0.5 EMBED_DIM=300 EPOCHS=20 GAMMA=0.1 HIDDEN_LAYER=200 LARGE_CELL_SIZE=100 LOG_INTERVAL=1 LR=0.001 N_CLASS=1997 NUM_LAYERS=1 PREDICT=None SAVE_DIR=snapshot/2018-03-24_23-55-54 SAVE_INTERVAL=500 SHUFFLE=False SMALL_CELL_SIZE=5 SNAPSHOT=None TAU=0.5 TEST=False TEST_INTERVAL=100 VOCAB_SIZE=25208 WORD_DICT=<torchtext.vocab.Vocab object at 0x7f4178266588> Traceback (most recent call last): File "main.py", line 111, in logits, h_stack, p_stack = skim_rnn_classifier(sent) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 224, in call result = self.forward(*input, *kwargs) File "/home/mldl/ub16_prj/Neural_Speed_Reading_via_Skim-RNN_PyTorch/skim_rnn.py", line 125, in forward pt = self.linear(torch.cat([embed.contiguous().view(-1, self.embed_dim), h_statel, cl], 1)) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 224, in call result = self.forward(input, *kwargs) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/linear.py", line 53, in forward return F.linear(input, self.weight, self.bias) File "/usr/local/lib/python3.5/dist-packages/torch/nn/functional.py", line 553, in linear return torch.addmm(bias, input, weight.t()) File "/usr/local/lib/python3.5/dist-packages/torch/autograd/variable.py", line 924, in addmm return cls._blas(Addmm, args, False) File "/usr/local/lib/python3.5/dist-packages/torch/autograd/variable.py", line 920, in _blas return cls.apply((tensors + (alpha, beta, inplace))) File "/usr/local/lib/python3.5/dist-packages/torch/autograd/_functions/blas.py", line 26, in forward matrix1, matrix2, out=output) RuntimeError: size mismatch at /pytorch/torch/lib/THC/generic/THCTensorMathBlas.cu:243 mldl@mldlUB1604:~/ub16_prj/Neural_Speed_Reading_via_Skim-RNN_PyTorch$

schelotto commented 6 years ago

Could you check if your dataset is stored in the correct form? I found N_CLASS=1997, which looks weird to me.

SeekPoint commented 6 years ago

I just clone this repo, nothing changes

maomaoamaomao commented 6 years ago

I have the same problem. Have you solved it?