Skip to content
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

Runtime error during 'python train.py' #8

Open
ramyaragh opened this issue Feb 5, 2018 · 4 comments
Open

Runtime error during 'python train.py' #8

ramyaragh opened this issue Feb 5, 2018 · 4 comments

Comments

@ramyaragh
Copy link

ramyaragh commented Feb 5, 2018

I successfully ran the word embedding, but while training I get this runtime error. Any suggestions?

File "train.py", line 59, in
cross_entropy, kld, coef = train_step(iteration, args.batch_size, args.use_cuda, args.dropout)
File "/pytorch_RVAE/model/rvae.py", line 104, in train
z=None)
File "
/pytorch/torch/lib/python2.7/site-packages/torch/nn/modules/module.py", line 325, in call
result = self.forward(*input, **kwargs)
File "/pytorch_RVAE/model/rvae.py", line 64, in forward
encoder_input = self.embedding(encoder_word_input, encoder_character_input)
File "/
/pytorch/torch/lib/python2.7/site-packages/torch/nn/modules/module.py", line 325, in call
result = self.forward(*input, **kwargs)
File "/pytorch_RVAE/selfModules/embedding.py", line 47, in forward
character_input = self.TDNN(character_input)
File "
/pytorch/torch/lib/python2.7/site-packages/torch/nn/modules/module.py", line 325, in call
result = self.forward(*input, **kwargs)
File "~/pytorch_RVAE/selfModules/tdnn.py", line 42, in forward
xs = [x.max(2)[0].squeeze(2) for x in xs]
RuntimeError: dimension out of range (expected to be in range of [-2, 1], but got 2)

@ruotianluo
Copy link

delete .squeeze(2)

@ramyaragh
Copy link
Author

Does not seem to help

preprocessed data was found and loaded
Traceback (most recent call last):
File "train.py", line 59, in
cross_entropy, kld, coef = train_step(iteration, args.batch_size, args.use_cuda, args.dropout)
File "/pytorch_RVAE/model/rvae.py", line 104, in train
z=None)
File "/anaconda/lib/python3.5/site-packages/torch/nn/modules/module.py", line 325, in call
result = self.forward(*input, **kwargs)
File "
/pytorch_RVAE/model/rvae.py", line 66, in forward
context = self.encoder(encoder_input)
File "/anaconda/lib/python3.5/site-packages/torch/nn/modules/module.py", line 325, in call
result = self.forward(*input, **kwargs)
File "/pytorch_RVAE/model/encoder.py", line 35, in forward
assert parameters_allocation_check(self),
File "
/pytorch_RVAE/utils/functional.py", line 15, in parameters_allocation_check
return fold(f_and, parameters, True) or not fold(f_or, parameters, False)
File "/pytorch_RVAE/utils/functional.py", line 2, in fold
return a if (len(l) == 0) else fold(f, l[1:], f(a, l[0]))
File "
/pytorch_RVAE/utils/functional.py", line 2, in fold
return a if (len(l) == 0) else fold(f, l[1:], f(a, l[0]))
File "~/pytorch_RVAE/utils/functional.py", line 6, in f_and
return x and y
File "/anaconda/lib/python3.5/site-packages/torch/autograd/variable.py", line 125, in bool
torch.typename(self.data) + " is ambiguous")
RuntimeError: bool value of Variable objects containing non-empty torch.FloatTensor is ambiguous

@ruotianluo
Copy link

ruotianluo commented Feb 13, 2018

That's a different error. What I did for this was just always return True in parameters_allocation_check function.

@SeekPoint
Copy link

@ruotianluo which version of pytorch do you working on?

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

No branches or pull requests

3 participants