-
Notifications
You must be signed in to change notification settings - Fork 0
Description
When I run the eval.py given trained model results in the following form:
python2 ./eval.py --model_path ./save/model.pth --infos_path ./save/infos_st.pkl --cnn_model_path ./save/model-cnn.pth --image_folder ./data/images/val --num_images 10
I got the runtime error like the following:
Traceback (most recent call last):
File "./eval.py", line 121, in <module>
vars(opt))
File "/home/student51/lab2/code/eval_utils.py", line 158, in eval_split
alp_curr = alph[k,t,:].view(7,7).data.cpu().numpy()
File "/usr/local/lib/python2.7/dist-packages/torch/tensor.py", line 374, in data
raise RuntimeError('cannot call .data on a torch.Tensor: did you intend to use autograd.Variable?')
RuntimeError: cannot call .data on a torch.Tensor: did you intend to use autograd.Variable?
I then changed the code in eval_utils.py line 158 into
alp_curr = alph[k,t,:].view(7,7).numpy()
Then the evaluation completed without any errors, output caption-image pairs in the vis folder (meta information in vis/vis.json & images in vis/images/) and attention images in the code folder, as well as the evaluation loss shown in stdout.
My question is: should we do such modification in eval_utils.py line 158? Or am I breaking something else without receiving explicit error messages?