Skip to content

Commit ddd4e57

Browse files
committed
Merge branch 'ddp_spawn' of github.com:daniellepintz/pytorch-lightning into ddp_spawn
2 parents a1a439d + 113645d commit ddd4e57

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

pytorch_lightning/plugins/training_type/ddp_spawn.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,8 @@ def post_training_step(self):
375375
self.model.require_backward_grad_sync = True
376376

377377
def add_to_queue(self, trainer: "pl.Trainer", queue: torch.multiprocessing.SimpleQueue) -> None:
378-
"""
379-
Appends the :attr:`trainer.callback_metrics` dictionary to the given queue.
380-
To avoid issues with memory sharing, we cast the data to numpy.
378+
"""Appends the :attr:`trainer.callback_metrics` dictionary to the given queue. To avoid issues with memory
379+
sharing, we cast the data to numpy.
381380
382381
Args:
383382
queue: the instance of the queue to append the data.
@@ -388,9 +387,8 @@ def add_to_queue(self, trainer: "pl.Trainer", queue: torch.multiprocessing.Simpl
388387
queue.put(callback_metrics)
389388

390389
def get_from_queue(self, trainer: "pl.Trainer", queue: torch.multiprocessing.SimpleQueue) -> None:
391-
"""
392-
Retrieve the :attr:`trainer.callback_metrics` dictionary from the given queue.
393-
To preserve consistency, we cast back the data to ``torch.Tensor``.
390+
"""Retrieve the :attr:`trainer.callback_metrics` dictionary from the given queue. To preserve consistency,
391+
we cast back the data to ``torch.Tensor``.
394392
395393
Args:
396394
queue: the instance of the queue from where to get the data.

tests/plugins/test_ddp_spawn_plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ def test_ddp_cpu():
6464

6565
@RunIf(min_gpus=2)
6666
def test_ddp_spawn_extra_parameters(tmpdir):
67-
"""Tests if device is set correctly when training for DDPSpawnPlugin
68-
and tests add_to_queue/get_from_queue with Lightning Module (deprecated way)."""
67+
"""Tests if device is set correctly when training for DDPSpawnPlugin and tests add_to_queue/get_from_queue with
68+
Lightning Module (deprecated way)."""
6969
trainer = Trainer(default_root_dir=tmpdir, fast_dev_run=True, gpus=2, accelerator="ddp_spawn")
7070

7171
assert isinstance(trainer.training_type_plugin, DDPSpawnPlugin)

0 commit comments

Comments
 (0)