cove icon indicating copy to clipboard operation
cove copied to clipboard

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

Open enverfakhan opened this issue 5 years ago • 0 comments

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

enverfakhan avatar May 22 '19 12:05 enverfakhan