Spaces:
Running on Zero
Running on Zero
Revert VAE encoding to original sequential loop
Browse files- gbuffer_utils.py +9 -9
gbuffer_utils.py
CHANGED
|
@@ -21,15 +21,15 @@ class WanVideoUnit_GBufferEncoder(PipelineUnit):
|
|
| 21 |
if gbuffer_videos is None:
|
| 22 |
return {}
|
| 23 |
pipe.load_models_to_device(self.onload_model_names)
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
gbuffer_latents =
|
| 33 |
if y is not None:
|
| 34 |
gbuffer_latents = torch.cat([y, gbuffer_latents], dim=1)
|
| 35 |
return {"y": gbuffer_latents}
|
|
|
|
| 21 |
if gbuffer_videos is None:
|
| 22 |
return {}
|
| 23 |
pipe.load_models_to_device(self.onload_model_names)
|
| 24 |
+
all_latents = []
|
| 25 |
+
for gbuffer_video in gbuffer_videos:
|
| 26 |
+
video_tensor = pipe.preprocess_video(gbuffer_video)
|
| 27 |
+
latent = pipe.vae.encode(
|
| 28 |
+
video_tensor, device=pipe.device,
|
| 29 |
+
tiled=tiled, tile_size=tile_size, tile_stride=tile_stride
|
| 30 |
+
).to(dtype=pipe.torch_dtype, device=pipe.device)
|
| 31 |
+
all_latents.append(latent)
|
| 32 |
+
gbuffer_latents = torch.cat(all_latents, dim=1) # [1, N*16, T, H, W]
|
| 33 |
if y is not None:
|
| 34 |
gbuffer_latents = torch.cat([y, gbuffer_latents], dim=1)
|
| 35 |
return {"y": gbuffer_latents}
|