Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

RunteimeError while executing context.t() "expects a tensor with <= 2 dimensions, but self is 3D" #24

Open
enverfakhan opened this issue May 22, 2019 · 0 comments

Comments

@enverfakhan
Copy link

I'm trying to train an NMT model to obtain CoVe vectors which will be used later on a QA task. I have a parallel corpus (Turkish-English), I prepared dataset for the model with preprocess.py script in the OpenNMT folder. I did exactly follow the examples in the README.md file of OpenNMT branch. I was able to track the error to the following point, however since I've no experience with torch I was stuck there;

outputs = model(batch) # script runs successfully until this command, which means model is 
                                      # created successfully
enc_hidden, context = self.encoder(src)  # it does execute this line successfully too.
                                                                 # at this point: context.dim() = 3
                                                                 # enc_hidden[0].dim()= 3; enc_hidden[1].dim()= 3

# then it calls decoder to obtain outputs, dec_hidden and and _atten,  problem occurs here
emb = self.word_lut(input)             # this line is executed; emb.dim()= 3
output, attn = self.attn(output, context.t()) # it fails at this line, and return the RuntimeError

I'm not sure if it because of the data or not, I run it with and without word_embedding, I did follow the example exactly, any help or pointing some direction would be very much appreciated, thanks in advance

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant