Skip to content

Commit 283c771

Browse files
committed
import torch.mp simplequeue class
1 parent f179ccb commit 283c771

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/lightning/pytorch/strategies/launchers/multiprocessing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import torch.multiprocessing as mp
2727
from lightning_utilities.core.apply_func import apply_to_collection
2828
from torch import Tensor
29+
from torch.multiprocessing.queue import SimpleQueue
2930
from typing_extensions import override
3031

3132
import lightning.pytorch as pl
@@ -160,7 +161,7 @@ def _wrapping_function(
160161
function: Callable,
161162
args: Any,
162163
kwargs: Any,
163-
return_queue: mp.SimpleQueue | queue.Queue,
164+
return_queue: SimpleQueue | queue.Queue,
164165
global_states: Optional["_GlobalStateSnapshot"] = None,
165166
) -> None:
166167
if global_states:

src/lightning/pytorch/strategies/launchers/xla.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from typing import TYPE_CHECKING, Any, Optional
1818

1919
import torch.multiprocessing as mp
20+
from torch.multiprocessing.queue import SimpleQueue
2021
from typing_extensions import override
2122

2223
from lightning.fabric.accelerators.xla import _XLA_AVAILABLE
@@ -127,7 +128,7 @@ def _wrapping_function(
127128
function: Callable,
128129
args: Any,
129130
kwargs: Any,
130-
return_queue: mp.SimpleQueue | queue.Queue,
131+
return_queue: SimpleQueue | queue.Queue,
131132
global_states: _GlobalStateSnapshot | None = None,
132133
) -> None:
133134
import torch_xla.core.xla_model as xm

0 commit comments

Comments
 (0)