-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluation Error : RuntimeError: rnn: hx is not contiguous #4
Comments
Hi, can you try calling |
Hi eric,
But, it is still not working, there was no issue at the time of training. The issue is showing only on running the |
Reading the error log, the issue is when calling the LSTM in Line 110. So try calling |
before this line output, hidden_i, attn_weights = self.onestep(output, hidden_i, src_out_i, vid_out_i, src_mask_i), I add .contiguous() after output and hidden_i as follows: |
@bozhenhhu I've tried the method you've suggested, but the code still does not work:( from utils import sos_idx, eos_idx class SoftDotAttention(nn.Module):
class Encoder(nn.Module):
class Decoder(nn.Module):
` |
Do you have the same environment as this repository, like the prerequisites? It has been a long time since this model was published, and many packages have been updated, which may result in incompatibility. Why not try the up-to-date methods? |
Training was successful. Data:
vatex_training_v1.0.json
vatex_validation_v1.0.json
vatex_public_test_english_v1.1.json
System: Google Colab GPU
When I tried to run the
python eval.py
, it is showing the following errorVocab size src/tgt:10523/2907
train/val/test size: 254/30/59
************ Start eval... ************
Use epoch 34 as the best model for testing
Traceback (most recent call last):
File "eval.py", line 123, in
main(args)
File "eval.py", line 63, in main
eval(test_loader, encoder, decoder, cp_file, tok_tgt, result_path)
File "eval.py", line 90, in eval
preds, pred_lengths = decoder.beam_decoding(srccap, init_hidden, src_out, vid_out, args.MAX_INPUT_LENGTH, beam_size=5)
File "/content/drive/My Drive/MMT/MMTvatex/Video-guided-Machine-Translation/model.py", line 208, in beam_decoding
output, hidden_i, attn_weights = self.onestep(output, hidden_i, src_out_i, vid_out_i, src_mask_i)
File "/content/drive/My Drive/MMT/MMTvatex/Video-guided-Machine-Translation/model.py", line 110, in onestep
output, hidden = self.decoder(rnn_input, last_hidden)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/rnn.py", line 570, in forward
self.dropout, self.training, self.bidirectional, self.batch_first)
RuntimeError: rnn: hx is not contiguous
Could you please tell me why is this happening?
Thank you.
The text was updated successfully, but these errors were encountered: