-
Notifications
You must be signed in to change notification settings - Fork 2
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
something wrong with "answer_vectors = default_collate(_answer_vectors)" in ansemb/dataset/data_utils.py #3
Comments
hi :) |
Hi, It seems that the variable ``batch'' here is not a tuple (or a list) of tensors. I think the easiest way to debug this is to set the number of workers to be 0 and then trace the line#95 of collate_fn in data_uils.py to see what kind of data structure this ``_anwer_vectors'' is. Best, |
Thank you so much. _train E000: 0% 0/3467 [00:02<?, ?it/s] And I use it print that : data structure of _answer_vectors: <class 'torch.Tensor'> |
this is the printed text before:@xxx:~/answer_embedding-master$ python train_vqa_embedding.py --gpu_id 1
And the way I used the image future file refer to vqa-resnet-14x14.h5 from How to generate "vqa-resnet-14x14.h5"? I modied the |
Hi, I think this error is very likely due to the change of pytorch version. Unfortunately that I do not have the machine & data to re-run this experiment at this moment. Can you see if it would work for you to change the L#95 ``answer_vectors = default_collate(_answer_vectors)'' to
If not, can you check the shape of ``_answer_vectors''? |
I change the L#95 ``answer_vectors = default_collate(_answer_vectors)'' to
|
This is because the type of ``answer_id'' is a tensor rather than a int. I think you can change it to:
|
it seems that some error raised during the computing of acc |
This one is also due to the API change of Pytorch. You can check the shape of Please refer to this https://pytorch.org/docs/stable/generated/torch.gather.html. Check some examples about how to use ``torch.gather'' on stackoverflow would be helpful for you to debug. |
yes they dont have the same dimensionality
|
It work! Thank you so much again! :) |
train E000: 0% 0/3467 [00:02<?, ?it/s]
Traceback (most recent call last):
File "train_vqa_embedding.py", line 266, in
main(args)
File "train_vqa_embedding.py", line 239, in main
train(context_net, answer_net, train_loader, optimizer, tracker, args, prefix='train', epoch=i)
File "train_vqa_embedding.py", line 108, in train
for v, q, avocab, a, labels, idx, q_len in tq:
File "/home/anaconda3/lib/python3.6/site-packages/tqdm/std.py", line 1130, in iter
for obj in iterable:
File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 345, in next
data = self._next_data()
File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 856, in _next_data
return self._process_data(data)
File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 881, in _process_data
data.reraise()
File "/home/anaconda3/lib/python3.6/site-packages/torch/_utils.py", line 394, in reraise
raise self.exc_type(msg)
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
data = fetcher.fetch(index)
File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch
return self.collate_fn(data)
File "/home/answer_embedding-master/ansemb/dataset/data_utils.py", line 95, in collate_fn
answer_vectors = default_collate(_answer_vectors)
File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/_utils/collate.py", line 55, in default_collate
return torch.stack(batch, 0, out=out)
TypeError: stack(): argument 'tensors' (position 1) must be tuple of Tensors, not Tensor
The text was updated successfully, but these errors were encountered: