Skip to content

Commit d46d93c

Browse files
akaitsuki-iisir1st-inc
authored andcommitted
use spawn context
1 parent c058acb commit d46d93c

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

diffsynth_engine/utils/parallel.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -331,19 +331,14 @@ def __init__(
331331
master_port: int = 29500,
332332
device: str = "cuda",
333333
):
334-
current_method = mp.get_start_method(allow_none=True)
335-
if current_method is None or current_method != "spawn":
336-
try:
337-
mp.set_start_method("spawn")
338-
except RuntimeError as e:
339-
raise RuntimeError("Failed to set start method to spawn:", e)
340334
super().__init__()
341335
self.config = module.config if isinstance(module, BasePipeline) else None
342336
self._module_name = module.__class__.__name__
343337

344338
self.world_size = cfg_degree * sp_ulysses_degree * sp_ring_degree * tp_degree
345-
self.queue_in = mp.Queue()
346-
self.queue_out = mp.Queue()
339+
spawn_ctx = mp.get_context("spawn")
340+
self.queue_in = spawn_ctx.Queue()
341+
self.queue_out = spawn_ctx.Queue()
347342
self.ctx = mp.spawn(
348343
_worker_loop,
349344
args=(

0 commit comments

Comments
 (0)