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

stack() fails #5

Open
StrangeTcy opened this issue Dec 10, 2018 · 2 comments
Open

stack() fails #5

StrangeTcy opened this issue Dec 10, 2018 · 2 comments

Comments

@StrangeTcy
Copy link

train.py fails on both training from scratch and using a pre-trained model with the following error:

File "/RelationNetworks-CLEVR/utils.py", line 120, in collate_samples
question=torch.stack(padded_questions)
TypeError: stack(): argument 'tensors' (position 1) must be tuple of Tensors, not Tensor

@StrangeTcy
Copy link
Author

If you use a list of torch.LongTensor.zero_()s instead, it seems to work.

@mesnico
Copy link
Owner

mesnico commented Dec 26, 2018

I think this issue is related with pytorch version you're using. Have you installed dependencies from the requirements.txt inside a virtualenv as explained in README?

As of now, this code works with pytorch 0.3.1. In later versions torch.stack() takes a sequence of Tensors as argument, so, if you are using a newer version of pytorch, torch.stack(list(padded_questions)) should work.
However, other things should be adjusted if you use another version. Hence, I encourage you to install version 0.3.1 inside a virtualenv.

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

2 participants