From a92bf7d14b02484d477d96ab7a39e174049e78a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Sun, 19 Dec 2021 21:47:54 +0100 Subject: [PATCH] Set spawn_method on initialization --- pytorch_lightning/plugins/training_type/tpu_spawn.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pytorch_lightning/plugins/training_type/tpu_spawn.py b/pytorch_lightning/plugins/training_type/tpu_spawn.py index 8b4f0536d6b5b..befcea324e271 100644 --- a/pytorch_lightning/plugins/training_type/tpu_spawn.py +++ b/pytorch_lightning/plugins/training_type/tpu_spawn.py @@ -71,7 +71,7 @@ def __init__( self.debug = debug self.tpu_local_core_rank = 0 self.tpu_global_core_rank = 0 - self.start_method = None + self.start_method = "fork" @property def global_rank(self) -> int: @@ -135,10 +135,6 @@ def pre_dispatch(self, trainer: "pl.Trainer") -> None: self.setup_optimizers(trainer) self.precision_plugin.connect(self.model, None, None) - def setup(self, trainer: "pl.Trainer") -> None: - self.start_method = "fork" - super().setup(trainer) - def _setup_model(self, model: Module) -> Module: return model