mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-10 12:21:57 +08:00
workers warning not on windows (#1430)
This commit is contained in:
@@ -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.')
|
||||
|
||||
Reference in New Issue
Block a user