mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
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.
This commit is contained in:
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user