Skip to content

Commit 8a40e80

Browse files
Bordacarmocca
andauthored
fix num_workers for Windows example (#5375)
* fix num_workers for Windows example * chlog * Apply suggestions from code review Co-authored-by: Carlos Mocholí <[email protected]> * warn Co-authored-by: Carlos Mocholí <[email protected]>
1 parent 3c6e06b commit 8a40e80

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
6262
- Fixed `DDPHPCAccelerator` hangs in DDP construction by calling `init_device` ([#5157](https://github.com/PyTorchLightning/pytorch-lightning/pull/5157))
6363

6464

65+
- Fixed `num_workers` for Windows example ([#5375](https://github.com/PyTorchLightning/pytorch-lightning/pull/5375))
66+
67+
6568
## [1.1.3rc] - 2020-12-29
6669

6770
### Added

pl_examples/basic_examples/mnist_datamodule.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414
import platform
1515
from typing import Optional
16+
from warnings import warn
1617

1718
from torch.utils.data import DataLoader, random_split
1819

@@ -55,8 +56,10 @@ def __init__(
5556
normalize: If true applies image normalize
5657
"""
5758
super().__init__(*args, **kwargs)
58-
if platform.system() == "Windows":
59-
# see: https://stackoverflow.com/a/59680818/4521646
59+
if num_workers and platform.system() == "Windows":
60+
# see: https://stackoverflow.com/a/59680818
61+
warn(f"You have requested num_workers={num_workers} on Windows,"
62+
" but currently recommended is 0, so we set it for you")
6063
num_workers = 0
6164

6265
self.dims = (1, 28, 28)

0 commit comments

Comments
 (0)