Fabrice-TIERCELIN commited on
Commit
447e5f3
·
verified ·
1 Parent(s): 283c17b

Unload models for video extension

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -645,6 +645,11 @@ def worker_video(input_video, prompts, n_prompt, seed, batch, resolution, total_
645
  load_model_as_complete(image_encoder, target_device=gpu)
646
 
647
  image_encoder_output = hf_clip_vision_encode(input_image_np, feature_extractor, image_encoder)
 
 
 
 
 
648
  image_encoder_last_hidden_state = image_encoder_output.last_hidden_state
649
 
650
  # Dtype
@@ -817,7 +822,7 @@ def worker_video(input_video, prompts, n_prompt, seed, batch, resolution, total_
817
  history_pixels = soft_append_bcthw(history_pixels, vae_decode(real_history_latents, vae).cpu(), overlapped_frames)
818
 
819
  if not high_vram:
820
- unload_complete_models()
821
 
822
  if enable_preview or section_index == total_latent_sections - 1:
823
  output_filename = os.path.join(outputs_folder, f'{job_id}_{total_generated_latent_frames}.mp4')
 
645
  load_model_as_complete(image_encoder, target_device=gpu)
646
 
647
  image_encoder_output = hf_clip_vision_encode(input_image_np, feature_extractor, image_encoder)
648
+
649
+ # Clean GPU
650
+ if not high_vram:
651
+ unload_complete_models(image_encoder)
652
+
653
  image_encoder_last_hidden_state = image_encoder_output.last_hidden_state
654
 
655
  # Dtype
 
822
  history_pixels = soft_append_bcthw(history_pixels, vae_decode(real_history_latents, vae).cpu(), overlapped_frames)
823
 
824
  if not high_vram:
825
+ unload_complete_models(text_encoder, text_encoder_2, image_encoder, vae, transformer)
826
 
827
  if enable_preview or section_index == total_latent_sections - 1:
828
  output_filename = os.path.join(outputs_folder, f'{job_id}_{total_generated_latent_frames}.mp4')