workers warning not on windows (#1430)

This commit is contained in:
William Falcon 2020-04-09 12:42:30 -04:00 committed by GitHub
parent 21a1972921
commit b4eb3884cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import warnings
import platform
from abc import ABC, abstractmethod
from typing import Union, List, Tuple, Callable
@ -75,7 +76,9 @@ class TrainerDataLoadingMixin(ABC):
raise ValueError(msg)
def _worker_check(self, dataloader: DataLoader, name: str) -> None:
if isinstance(dataloader, DataLoader) and dataloader.num_workers <= 2:
on_windows = platform.system() == 'Windows'
if isinstance(dataloader, DataLoader) and dataloader.num_workers <= 2 and not on_windows:
warnings.warn(f'The dataloader, {name}, does not have many workers which may be a bottleneck.'
' Consider increasing the value of the `num_workers` argument`'
' in the `DataLoader` init to improve performance.')