aleafy commited on
Commit
edadb90
·
1 Parent(s): 5e2f182
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -228,8 +228,10 @@ inf_pipe = InferenceIP2PVideo(
228
  @spaces.GPU
229
  def dummy_process(input_fg, input_bg):
230
  # import pdb; pdb.set_trace()
231
- fg_tensor = load_and_process_video(input_fg).cuda().unsqueeze(0)
232
- bg_tensor = load_and_process_video(input_bg).cuda().unsqueeze(0) # (1, 16, 4, 64, 64)
 
 
233
 
234
  cond_fg_tensor = diffusion_model.encode_image_to_latent(fg_tensor) # (1, 16, 4, 64, 64)
235
  cond_bg_tensor = diffusion_model.encode_image_to_latent(bg_tensor)
@@ -260,6 +262,7 @@ def dummy_process(input_fg, input_bg):
260
  text_cfg=TEXT_CFG,
261
  img_cfg=VIDEO_CFG,
262
  )['latent']
 
263
 
264
  image_pred = diffusion_model.decode_latent_to_image(latent_pred) # (1,16,3,512,512)
265
  output_path = os.path.join(new_tmp_dir, f"output_{int(time.time())}.mp4")
 
228
  @spaces.GPU
229
  def dummy_process(input_fg, input_bg):
230
  # import pdb; pdb.set_trace()
231
+
232
+ diffusion_model.to(torch.float16)
233
+ fg_tensor = load_and_process_video(input_fg).cuda().unsqueeze(0).to(dtype=torch.float16)
234
+ bg_tensor = load_and_process_video(input_bg).cuda().unsqueeze(0).to(dtype=torch.float16) # (1, 16, 4, 64, 64)
235
 
236
  cond_fg_tensor = diffusion_model.encode_image_to_latent(fg_tensor) # (1, 16, 4, 64, 64)
237
  cond_bg_tensor = diffusion_model.encode_image_to_latent(bg_tensor)
 
262
  text_cfg=TEXT_CFG,
263
  img_cfg=VIDEO_CFG,
264
  )['latent']
265
+
266
 
267
  image_pred = diffusion_model.decode_latent_to_image(latent_pred) # (1,16,3,512,512)
268
  output_path = os.path.join(new_tmp_dir, f"output_{int(time.time())}.mp4")