From c750015c801e9edc160fc69b13c4a95894f06e6d Mon Sep 17 00:00:00 2001 From: William Falcon Date: Mon, 8 Jul 2019 17:31:47 -0400 Subject: [PATCH] added single node example --- pytorch_lightning/models/trainer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pytorch_lightning/models/trainer.py b/pytorch_lightning/models/trainer.py index f2252186..f1e1881d 100644 --- a/pytorch_lightning/models/trainer.py +++ b/pytorch_lightning/models/trainer.py @@ -289,7 +289,11 @@ class Trainer(TrainerIO): :return: """ # node rank using relative slurm id - node_rank = int(os.environ['SLURM_NODEID']) + # otherwise default to node rank 0 + try: + node_rank = int(os.environ['SLURM_NODEID']) + except KeyError as e: + node_rank = 0 # recover original exp before went into process self.experiment = self.experiment.get_non_ddp_exp()