workers warning not on windows (#1430)
This commit is contained in:
parent
21a1972921
commit
b4eb3884cf
|
@ -1,4 +1,5 @@
|
||||||
import warnings
|
import warnings
|
||||||
|
import platform
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import Union, List, Tuple, Callable
|
from typing import Union, List, Tuple, Callable
|
||||||
|
|
||||||
|
@ -75,7 +76,9 @@ class TrainerDataLoadingMixin(ABC):
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
|
|
||||||
def _worker_check(self, dataloader: DataLoader, name: str) -> None:
|
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.'
|
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`'
|
' Consider increasing the value of the `num_workers` argument`'
|
||||||
' in the `DataLoader` init to improve performance.')
|
' in the `DataLoader` init to improve performance.')
|
||||||
|
|
Loading…
Reference in New Issue