Skip to content

Commit

Permalink
Small optimization.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Jun 15, 2024
1 parent f2e844e commit 1281f93
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions comfy/ldm/modules/diffusionmodules/mmdit.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ def timestep_embedding(t, dim, max_period=10000):
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:
Expand Down

0 comments on commit 1281f93

Please sign in to comment.