From 8b738636d071d3ff3b284ac018edd6f6cddc8bc3 Mon Sep 17 00:00:00 2001 From: Tai An Date: Sat, 5 Sep 2026 21:22:27 -0700 Subject: [PATCH] fix(todo): drop the unreachable duplicate branch in init_generator The third branch repeats `device.type == "cuda"`, so it can never run, and it cannot be enabled by correcting the condition either: the Generator API rejects MPS outright. The repo's other copy of this helper, modules/hidiffusion/utils.py, has cpu/cuda/else and no third branch. --- modules/todo/todo_merge.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/todo/todo_merge.py b/modules/todo/todo_merge.py index 158bc36b1..c866f1391 100644 --- a/modules/todo/todo_merge.py +++ b/modules/todo/todo_merge.py @@ -29,8 +29,6 @@ def init_generator(device: torch.device, fallback: torch.Generator = None): return torch.Generator(device="cpu").set_state(torch.get_rng_state()) elif device.type == "cuda": return torch.Generator(device=device).set_state(torch.cuda.get_rng_state()) - elif device.type == "cuda": - return torch.Generator(device=device).set_state(torch.mps.get_rng_state()) else: if fallback is None: return init_generator(torch.device("cpu"))