From 0c264689cb566582ac47333d8b7192d656e19440 Mon Sep 17 00:00:00 2001 From: William Falcon Date: Thu, 13 Aug 2020 21:54:57 -0400 Subject: [PATCH] Fixes #2942 (#2969) * Fixes #2942 * doc fix --- docs/source/debugging.rst | 4 ++-- pytorch_lightning/accelerators/ddp_backend.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/debugging.rst b/docs/source/debugging.rst index 56c96607bc..19c75acae1 100644 --- a/docs/source/debugging.rst +++ b/docs/source/debugging.rst @@ -1,8 +1,8 @@ .. testsetup:: * from pytorch_lightning.trainer.trainer import Trainer - - .. _debugging: + +.. _debugging: Debugging ========= diff --git a/pytorch_lightning/accelerators/ddp_backend.py b/pytorch_lightning/accelerators/ddp_backend.py index 62e8344c17..2ecf084774 100644 --- a/pytorch_lightning/accelerators/ddp_backend.py +++ b/pytorch_lightning/accelerators/ddp_backend.py @@ -87,7 +87,7 @@ class DDPBackend(object): command = [sys.executable] + command # since this script sets the visible devices we replace the gpus flag with a number - num_gpus = os.environ['CUDA_VISIBLE_DEVICES'].split(',').__len__() + num_gpus = os.environ.get('CUDA_VISIBLE_DEVICES', []).split(',').__len__() if '--gpus' in command: gpu_flag_idx = command.index('--gpus')