Skip to content

Commit

Permalink
WAR the dataloader issue with forked processes holding stale referenc…
Browse files Browse the repository at this point in the history
…es (apache#19924)
  • Loading branch information
ptrendx authored and Zha0q1 committed Feb 24, 2021
1 parent ac45c6e commit 0d9a7fa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/mxnet/gluon/data/dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,10 @@ def __init__(self, dataset, batch_size=None, shuffle=False, sampler=None,
self._num_workers = num_workers if num_workers >= 0 else 0
self._worker_pool = None
self._prefetch = max(0, int(prefetch) if prefetch is not None else 2 * self._num_workers)
nd.waitall()
import gc
gc.collect()
nd.waitall()
if self._num_workers > 0:
if self._thread_pool:
self._worker_pool = ThreadPool(self._num_workers,
Expand Down

0 comments on commit 0d9a7fa

Please sign in to comment.