Exception ignored in: <function _MultiProcessingDataLoaderIter.__del__ at

Exception ignored in: <function _MultiProcessingDataLoaderIter.__del__ at 0x7f231e2bd8b0>
Traceback (most recent call last):
  File "/home/a09/software/anaconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1328, in __del__
    self._shutdown_workers()
  File "/home/a09/software/anaconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1320, in _shutdown_workers
    if w.is_alive():
  File "/home/a09/software/anaconda3/lib/python3.8/multiprocessing/process.py", line 160, in is_alive
    assert self._parent_pid == os.getpid(), 'can only test a child process'
AssertionError: can only test a child process

mycode is here:

batch_size=512
trainset=mydataset(text,win_size,neg_per_pos,freqs,word2idx)
trainloader=tud.DataLoader(trainset,batch_size=batch_size,shuffle=True,num_workers=1)
it=iter(trainloader)
centers,poss,negs=next(it)
print(centers.shape)
print(poss.shape)
print(negs.shape)

and then the warning occurs,i guess it’s about the parameter “num_workers”,but i really want to use that.

You might be running into a similar issue as described here which seems to point to a bad interaction between tqdm and Python’s multiprocessing module.

1 Like