Skip to content
Snippets Groups Projects
Unverified Commit 16ef54c4 authored by RangiLyu's avatar RangiLyu Committed by GitHub
Browse files

[Fix] Fix compatibility of persistent_workers. (#379)

parent 6bd548d8
No related branches found
No related tags found
No related merge requests found
...@@ -1382,6 +1382,13 @@ class Runner: ...@@ -1382,6 +1382,13 @@ class Runner:
else: else:
init_fn = None init_fn = None
# `persistent_workers` requires pytorch version >= 1.7
if ('persistent_workers' in dataloader_cfg
and digit_version(TORCH_VERSION) < digit_version('1.7.0')):
warnings.warn('`persistent_workers` is only available when '
'pytorch version >= 1.7')
dataloader_cfg.pop('persistent_workers')
# The default behavior of `collat_fn` in dataloader is to # The default behavior of `collat_fn` in dataloader is to
# merge a list of samples to form a mini-batch of Tensor(s). # merge a list of samples to form a mini-batch of Tensor(s).
# However, to make this more flexible, collate_fn in MMengine does # However, to make this more flexible, collate_fn in MMengine does
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment