Received 0 items of ancdata Pytorch 0.4.0

Upon iterating over the dataloader I receive RuntimeError: received 0 items of ancdata. I tried by increasing number of open file descriptors as shown in https://github.com/pytorch/pytorch/issues/973 but to no avail. Can someone please guide how this error could be prevented.
x, (y_l, y_ab) = next(loader)
where loader is defined as following
loader = cycle(train_dataloader)

The complete error traceback is given below.

Traceback (most recent call last):
  File "main_mse.py", line 267, in <module>
    main()
  File "main_mse.py", line 263, in main
    train(g_model, d_model, learning_rate_ae, learning_rate_color, train_dataloader, test_dataloader, now)
  File "main_mse.py", line 111, in train
    x, (y_l, y_ab) = next(loader)
  File "/home/thor/anaconda3/envs/torch3env/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 280, in __next__
    idx, batch = self._get_batch()
  File "/home/thor/anaconda3/envs/torch3env/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 259, in _get_batch
    return self.data_queue.get()
  File "/home/thor/anaconda3/envs/torch3env/lib/python3.6/multiprocessing/queues.py", line 337, in get
    return _ForkingPickler.loads(res)
  File "/home/thor/anaconda3/envs/torch3env/lib/python3.6/site-packages/torch/multiprocessing/reductions.py", line 70, in rebuild_storage_fd
    fd = df.detach()
  File "/home/thor/anaconda3/envs/torch3env/lib/python3.6/multiprocessing/resource_sharer.py", line 58, in detach
    return reduction.recv_handle(conn)
  File "/home/thor/anaconda3/envs/torch3env/lib/python3.6/multiprocessing/reduction.py", line 182, in recv_handle
    return recvfds(s, 1)[0]
  File "/home/thor/anaconda3/envs/torch3env/lib/python3.6/multiprocessing/reduction.py", line 161, in recvfds
    len(ancdata))
RuntimeError: received 0 items of ancdata
1 Like

Also having this issue. My sharing strategy is file_descriptor

Can you share your snippet as well ?

torch.multiprocessing.set_sharing_strategy('file_system')

solved the problem for me.

or

echo "ulimit -n 4096" >> .bashrc
echo "ulimit -n 4096" >> .bash_profile
source ~/.bashrc
6 Likes

thank you for your method !!! :grinning: