Skip to content

Commit 0196914

Browse files
authored
Fix Helios auto offload decode (#14140)
* Fix Helios auto offload decode * Fix Helios decode offload device handling and add regression test * Remove redundant Helios offload test
1 parent e276555 commit 0196914

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/diffusers/modular_pipelines/helios/decoders.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,19 @@ def __call__(self, components, state: PipelineState) -> PipelineState:
7676
block_state = self.get_block_state(state)
7777

7878
vae = components.vae
79+
device = components._execution_device
80+
decode_dtype = vae.dtype
7981

8082
latents_mean = (
81-
torch.tensor(vae.config.latents_mean).view(1, vae.config.z_dim, 1, 1, 1).to(vae.device, vae.dtype)
83+
torch.tensor(vae.config.latents_mean).view(1, vae.config.z_dim, 1, 1, 1).to(device, decode_dtype)
8284
)
8385
latents_std = 1.0 / torch.tensor(vae.config.latents_std).view(1, vae.config.z_dim, 1, 1, 1).to(
84-
vae.device, vae.dtype
86+
device, decode_dtype
8587
)
8688

8789
history_video = None
8890
for chunk_latents in block_state.latent_chunks:
89-
current_latents = chunk_latents.to(vae.dtype) / latents_std + latents_mean
91+
current_latents = chunk_latents.to(device=device, dtype=decode_dtype) / latents_std + latents_mean
9092
current_video = vae.decode(current_latents, return_dict=False)[0]
9193

9294
if history_video is None:

0 commit comments

Comments
 (0)