Skip to content

Commit

Permalink
Fix unet ops not entirely on GPU.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Nov 7, 2023
1 parent 844dbf9 commit 2a23ba0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions comfy/ldm/modules/diffusionmodules/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ def timestep_embedding(timesteps, dim, max_period=10000, repeat_only=False):
if not repeat_only:
half = dim // 2
freqs = torch.exp(
-math.log(max_period) * torch.arange(start=0, end=half, dtype=torch.float32) / half
).to(device=timesteps.device)
-math.log(max_period) * torch.arange(start=0, end=half, dtype=torch.float32, device=timesteps.device) / half
)
args = timesteps[:, None].float() * freqs[None]
embedding = torch.cat([torch.cos(args), torch.sin(args)], dim=-1)
if dim % 2:
Expand Down

0 comments on commit 2a23ba0

Please sign in to comment.