Skip to content

Commit

Permalink
Dp default (#560)
Browse files Browse the repository at this point in the history
* set auto dp if no backend

* fix imagenet example

* run flake8 first to fail build on syntax first
  • Loading branch information
williamFalcon authored Nov 28, 2019
1 parent d71556e commit 29122e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions pytorch_lightning/trainer/ddp_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,13 @@ def set_distributed_mode(self, distributed_backend, nb_gpu_nodes):
self.use_ddp2 = distributed_backend == 'ddp2'

elif distributed_backend is None:
m = 'When using multiple GPUs set ' \
'Trainer(distributed_backend=dp) (or ddp)'
raise MisconfigurationException(m)
m = 'You requested multiple GPUs but did not specify a backend' \
'Trainer(distributed_backend=dp) (or ddp, ddp2)' \
'Setting distributed_backend=dp for you'
warnings.warn(m)
self.use_dp = True
self.use_ddp = False
self.use_ddp2 = False

# throw error to force user ddp or ddp2 choice
if nb_gpu_nodes > 1 and not (self.use_ddp2 or self.use_ddp): # pragma: no cover
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# - check-manifest
# confirm items checked into vcs are in your segdist
# - python setup.py check
# - python setup.py check
# confirm required package meta-data in setup.py
# - readme_renderer (when using a ReStructuredText README)
# confirms your long_description will render correctly on PyPI.
Expand Down Expand Up @@ -37,8 +37,8 @@ commands =
pip list
check-manifest --ignore requirements-ci.txt
python setup.py check --metadata --strict
coverage run --source pytorch_lightning -m py.test pytorch_lightning tests pl_examples -v --doctest-modules
flake8 .
coverage run --source pytorch_lightning -m py.test pytorch_lightning tests pl_examples -v --doctest-modules
python setup.py sdist
twine check dist/*

Expand Down

0 comments on commit 29122e4

Please sign in to comment.