xiadingZ / video-caption.pytorch

pytorch implementation of video captioning
MIT License
401 stars 130 forks source link

Size mismatch at EncoderRNN.py #14

Closed Hassaan-Elahi closed 6 years ago

Hassaan-Elahi commented 6 years ago

I did all the prerequisites i.e download the dataset , extract features and build vocab before start training. When I started training a run time error occurred.

File "drive/DeepLearning/PytorchModel/Pytorch/train.py", line 138, in main(opt) File "drive/DeepLearning/PytorchModel/Pytorch/train.py", line 121, in main train(dataloader, model, crit, optimizer, exp_lr_scheduler, opt, rl_crit) File "drive/DeepLearning/PytorchModel/Pytorch/train.py", line 40, in train seqprobs, = model(fc_feats, labels, 'train') File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(*input, kwargs) File "/content/drive/DeepLearning/PytorchModel/Pytorch/models/S2VTAttModel.py", line 28, in forward encoder_outputs, encoder_hidden = self.encoder(vid_feats) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(*input, *kwargs) File "/content/drive/DeepLearning/PytorchModel/Pytorch/models/EncoderRNN.py", line 53, in forward vid_feats = self.vid2hid(vid_feats.view(-1, dim_vid)) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(input, kwargs) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/linear.py", line 55, in forward return F.linear(input, self.weight, self.bias) File "/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py", line 992, in linear return torch.addmm(bias, input, weight.t()) RuntimeError: size mismatch, m1: [4000 x 2048], m2: [4096 x 512] at /pytorch/aten/src/THC/generic/THCTensorMathBlas.cu:249

zhjohnchan commented 6 years ago

Change the parameter 'dim_vid' to 2048.

GauravKrRoy commented 5 years ago

@zhjohnchan I got ValueError: not enough values to unpack (expected 3, got 2) while running train.py Details are: Traceback (most recent call last): File "train.py", line 133, in main(opt) File "train.py", line 120, in main train(dataloader, model, crit, optimizer, exp_lr_scheduler, opt, rl_crit) File "train.py", line 40, in train seqprobs, = model(fc_feats, labels, 'train') File "/home/pg2018/cse/18071003/.conda/envs/env_name/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, *kwargs) File "/home/pg2018/cse/18071003/video-captioning/models/S2VTAttModel.py", line 28, in forward encoder_outputs, encoder_hidden = self.encoder(vid_feats) File "/home/pg2018/cse/18071003/.conda/envs/env_name/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(input, **kwargs) File "/home/pg2018/cse/18071003/video-captioning/models/EncoderRNN.py", line 52, in forward batch_size, seq_len, dim_vid = vid_feats.size() ValueError: not enough values to unpack (expected 3, got 2)