Update pipeline.py

This commit is contained in:
smthemex
2025-01-17 08:49:27 +08:00
committed by GitHub
parent d69b0bd75e
commit e4a914c699
+5 -3
View File
@@ -478,8 +478,8 @@ class LQ2VideoLongSVDPipeline(DiffusionPipeline):
# 4. Encode input image using VAE
needs_upcasting = (self.vae.dtype == torch.float16 or self.vae.dtype == torch.bfloat16) and self.vae.config.force_upcast
vae_dtype = self.vae.dtype
if needs_upcasting:
self.vae.to(dtype=torch.float32)
# if needs_upcasting:
# self.vae.to(dtype=torch.float32)
# Prepare ref image latents
ref_image_tensor = ref_image.to(
@@ -690,6 +690,8 @@ class LQ2VideoLongSVDPipeline(DiffusionPipeline):
# cast back to fp16 if needed
if needs_upcasting:
self.vae.to(dtype=vae_dtype)
#print(latents.shape,latents.dtype) #torch.Size([1, 16, 4, 32, 32]) torch.float16
frames = self.decode_latents(latents, num_frames, decode_chunk_size)
else:
frames = latents
@@ -807,4 +809,4 @@ def _gaussian_blur2d(input, kernel_size, sigma):
out_x = _filter2d(input, kernel_x[..., None, :])
out = _filter2d(out_x, kernel_y[..., None])
return out
return out