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

RuntimeError: each element in list of batch should be of equal size #13

Open
VahidChahkandi opened this issue Dec 10, 2020 · 0 comments

Comments

@VahidChahkandi
Copy link

VahidChahkandi commented Dec 10, 2020

Hi,
In test mode, on pre-trained non-autoregressive model and with the MS COCO dataset, I got the RuntimeError about the batch size as below, As I should write another Collate function or I have to do something else? Could you please advise me in this regard?

start decoding:   0%|          | 0/200 [00:00<?, ?it/s]Traceback (most recent call last):
  File "/media/deeplab/f6321bd3-2eb4-461a-9abc-d10e94252592/Vahid Chahkandi/dl4mt-nonauto-master/run.py", line 612, in <module> 
   names=["test." + xx for xx in names], maxsteps=None)

  File "/media/deeplab/f6321bd3-2eb4-461a-9abc-d10e94252592/Vahid Chahkandi/dl4mt-nonauto-master/decode.py", line 173, in decode_model  
for iters, dev_batch in enumerate(dev):

  File "/home/deeplab/dl4mt-nonauto-master/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 363, 
in __next__
    data = self._next_data()

  File "/home/deeplab/dl4mt-nonauto-master/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 989, 
in _next_data
    return self._process_data(data)

  File "/home/deeplab/dl4mt-nonauto-master/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1014,
 in _process_data  data.reraise()
  File "/home/deeplab/dl4mt-nonauto-master/lib/python3.7/site-packages/torch/_utils.py", line 395, 
in reraise  raise self.exc_type(msg)
RuntimeError: Caught RuntimeError in DataLoader worker process 0.
Original Traceback (most recent call last):

  File "/home/deeplab/dl4mt-nonauto-master/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 185, 
in _worker_loop  data = fetcher.fetch(index)

  File "/home/deeplab/dl4mt-nonauto-master/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 47, 
in fetch
    return self.collate_fn(data)

  File "/home/deeplab/dl4mt-nonauto-master/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 84, 
in default_collate   return [default_collate(samples) for samples in transposed]

  File "/home/deeplab/dl4mt-nonauto-master/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 84, 
in <listcomp>
    return [default_collate(samples) for samples in transposed]

  File "/home/deeplab/dl4mt-nonauto-master/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 82, 
in default_collate    raise RuntimeError('each element in list of batch should be of equal size')
RuntimeError: each element in list of batch should be of equal size

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

1 participant