Skip to content

Commit

Permalink
fix: RET505
Browse files Browse the repository at this point in the history
  • Loading branch information
uniartisan committed Dec 20, 2024
1 parent dc6430c commit 4dd9e25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/lightning/fabric/strategies/ddp.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,11 @@ def _create_stream_context(self, device_ids=None):
and device_ids is not None
):
stream = self.torch_lib.Stream()
return self.torch_lib.stream(stream)
ctx = self.torch_lib.stream(stream)
else:
from contextlib import nullcontext

return nullcontext()
ctx = nullcontext()
return ctx


class _DDPBackwardSyncControl(_BackwardSyncControl):
Expand Down
6 changes: 3 additions & 3 deletions src/lightning/pytorch/strategies/ddp.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,11 @@ def _create_stream_context(self, device_ids=None):
and device_ids is not None
):
stream = self.torch_lib.Stream()
return self.torch_lib.stream(stream)
ctx = self.torch_lib.stream(stream)
else:
from contextlib import nullcontext

return nullcontext()
ctx = nullcontext()
return ctx


class _DDPForwardRedirection(_ForwardRedirection):
Expand Down

0 comments on commit 4dd9e25

Please sign in to comment.