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

Error in eval #55

Closed
dhimanpd opened this issue Jun 21, 2018 · 4 comments
Closed

Error in eval #55

dhimanpd opened this issue Jun 21, 2018 · 4 comments

Comments

@dhimanpd
Copy link

dhimanpd commented Jun 21, 2018

I am encountering following error. Can somebody help me to resolve this issue?

python eval.py --model no_finetune/att2in/model-best.pth --infos_path no_finetune/att2in/infos_a2i-best.pkl --image_folder ../images/ --num_images 5
DataLoaderRaw loading images from folder: ../images/
0
listing all images in directory ../images/
DataLoaderRaw found 4 images
Traceback (most recent call last):
File "eval.py", line 122, in
vars(opt))
File "/home/prince/imageCaptioning/ImageCaptioning.pytorch/eval_utils.py", line 102, in eval_split
seq, _ = model.sample(fc_feats, att_feats, eval_kwargs)
File "/home/prince/imageCaptioning/ImageCaptioning.pytorch/models/Att2inModel.py", line 197, in sample
return self.sample_beam(fc_feats, att_feats, opt)
File "/home/prince/imageCaptioning/ImageCaptioning.pytorch/models/Att2inModel.py", line 186, in sample_beam
self.done_beams[k] = self.beam_search(state, logprobs, tmp_fc_feats, tmp_att_feats, tmp_p_att_feats, opt=opt)
File "/home/prince/imageCaptioning/ImageCaptioning.pytorch/models/CaptionModel.py", line 105, in beam_search
state)
File "/home/prince/imageCaptioning/ImageCaptioning.pytorch/models/CaptionModel.py", line 50, in beam_step
candidate_logprob = beam_logprobs_sum[q] + local_logprob
RuntimeError: Expected object of type torch.FloatTensor but found type torch.cuda.FloatTensor for argument #3 'other'

RuntimeError: Expected object of type torch.FloatTensor but found type torch.cuda.FloatTensor for argument #3 'other'

I have a GPU and I have confirmed that torch is using that GPU

@ruotianluo
Copy link
Owner

Are you using pytorch 0.4?

@dhimanpd
Copy link
Author

@ruotianluo Yes. I am using pytorch 0.4

@ruotianluo
Copy link
Owner

I haven't updated this repo to 0.4. So try using pytorch 0.3 for now,

@dhimanpd
Copy link
Author

It was my bad. I should have read the documentation carefully. Thanks for the patience and expedite resolve.

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