Skip to content

Commit 2a23ba0

Browse files
Fix unet ops not entirely on GPU.
1 parent 844dbf9 commit 2a23ba0

File tree

1 file changed

+2
-2
lines changed
  • comfy/ldm/modules/diffusionmodules

1 file changed

+2
-2
lines changed

comfy/ldm/modules/diffusionmodules/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ def timestep_embedding(timesteps, dim, max_period=10000, repeat_only=False):
170170
if not repeat_only:
171171
half = dim // 2
172172
freqs = torch.exp(
173-
-math.log(max_period) * torch.arange(start=0, end=half, dtype=torch.float32) / half
174-
).to(device=timesteps.device)
173+
-math.log(max_period) * torch.arange(start=0, end=half, dtype=torch.float32, device=timesteps.device) / half
174+
)
175175
args = timesteps[:, None].float() * freqs[None]
176176
embedding = torch.cat([torch.cos(args), torch.sin(args)], dim=-1)
177177
if dim % 2:

0 commit comments

Comments
 (0)