Skip to content

Commit

Permalink
fix num_workers for Windows example (#5375)
Browse files Browse the repository at this point in the history
* fix num_workers for Windows example

* chlog

* Apply suggestions from code review

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* warn

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
  • Loading branch information
Borda and carmocca authored Jan 7, 2021
1 parent 3c6e06b commit 8a40e80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed `DDPHPCAccelerator` hangs in DDP construction by calling `init_device` ([#5157](https://github.com/PyTorchLightning/pytorch-lightning/pull/5157))


- Fixed `num_workers` for Windows example ([#5375](https://github.com/PyTorchLightning/pytorch-lightning/pull/5375))


## [1.1.3rc] - 2020-12-29

### Added
Expand Down
7 changes: 5 additions & 2 deletions pl_examples/basic_examples/mnist_datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.
import platform
from typing import Optional
from warnings import warn

from torch.utils.data import DataLoader, random_split

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

self.dims = (1, 28, 28)
Expand Down

0 comments on commit 8a40e80

Please sign in to comment.