1inkusFace commited on
Commit
7c92a59
·
verified ·
1 Parent(s): 98b4122

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
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
- with torch.no_grad():
119
- image = pipe.video_processor.preprocess(image, height=size, width=size).to(
120
- device, dtype=prompt_embeds.dtype
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,