Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -115,10 +115,13 @@ def generate(segment, image, prompt, size, guidance_scale, num_inference_steps,
|
|
115 |
num_channels_latents = int(num_channels_latents / 2)
|
116 |
image = Image.open(image).convert('RGB')
|
117 |
image.resize((size,size), Image.LANCZOS)
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
|
|
122 |
num_latent_frames = (frames - 1) // pipe.vae_scale_factor_temporal + 1
|
123 |
latents = pipe.prepare_latents(
|
124 |
batch_size=1, num_channels_latents=pipe.transformer.config.in_channels, height=size, width=size, num_frames=frames,
|
|
|
115 |
num_channels_latents = int(num_channels_latents / 2)
|
116 |
image = Image.open(image).convert('RGB')
|
117 |
image.resize((size,size), Image.LANCZOS)
|
118 |
+
|
119 |
+
#with torch.no_grad():
|
120 |
+
pipe.vae.to("cpu")
|
121 |
+
image = pipe.video_processor.preprocess(image, height=size, width=size).to(
|
122 |
+
device, dtype=prompt_embeds.dtype
|
123 |
+
)
|
124 |
+
pipe.vae.to("cuda")
|
125 |
num_latent_frames = (frames - 1) // pipe.vae_scale_factor_temporal + 1
|
126 |
latents = pipe.prepare_latents(
|
127 |
batch_size=1, num_channels_latents=pipe.transformer.config.in_channels, height=size, width=size, num_frames=frames,
|