Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Small optimization.

comfyanonymous1281f933c1c3
diff --git a/comfy/ldm/modules/diffusionmodules/mmdit.py b/comfy/ldm/modules/diffusionmodules/mmdit.py
index 0cb6bd312..20d3a321a 100644
--- a/comfy/ldm/modules/diffusionmodules/mmdit.py
+++ b/comfy/ldm/modules/diffusionmodules/mmdit.py
@@ -243,9 +243,9 @@ class TimestepEmbedder(nn.Module):
half = dim // 2
freqs = torch.exp(
-math.log(max_period)
- * torch.arange(start=0, end=half, dtype=torch.float32)
+ * torch.arange(start=0, end=half, dtype=torch.float32, device=t.device)
/ half
- ).to(device=t.device)
+ )
args = t[:, None].float() * freqs[None]
embedding = torch.cat([torch.cos(args), torch.sin(args)], dim=-1)
if dim % 2: