Spaces:
Runtime error
Runtime error
Unload models
Browse files- app_start_end.py +10 -4
app_start_end.py
CHANGED
|
@@ -416,6 +416,12 @@ def worker(input_image, end_image, prompts, n_prompt, seed, total_second_length,
|
|
| 416 |
# Combine both image embeddings or use a weighted approach
|
| 417 |
image_encoder_last_hidden_state = (image_encoder_last_hidden_state + end_image_encoder_last_hidden_state) / 2
|
| 418 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 419 |
# Dtype
|
| 420 |
image_encoder_last_hidden_state = image_encoder_last_hidden_state.to(transformer.dtype)
|
| 421 |
|
|
@@ -425,7 +431,7 @@ def worker(input_image, end_image, prompts, n_prompt, seed, total_second_length,
|
|
| 425 |
rnd = torch.Generator("cpu").manual_seed(seed)
|
| 426 |
num_frames = latent_window_size * 4 - 3
|
| 427 |
|
| 428 |
-
history_latents = torch.zeros(size=(1, 16, 1 + 2 + 16, height // 8, width // 8), dtype=torch.float32
|
| 429 |
history_pixels = None
|
| 430 |
total_generated_latent_frames = 0
|
| 431 |
|
|
@@ -546,7 +552,7 @@ def worker(input_image, end_image, prompts, n_prompt, seed, total_second_length,
|
|
| 546 |
history_pixels = soft_append_bcthw(current_pixels, history_pixels, overlapped_frames)
|
| 547 |
|
| 548 |
if not high_vram:
|
| 549 |
-
unload_complete_models()
|
| 550 |
|
| 551 |
output_filename = os.path.join(outputs_folder, f'{job_id}_{total_generated_latent_frames}.mp4')
|
| 552 |
|
|
@@ -902,12 +908,12 @@ def process(input_image,
|
|
| 902 |
resolution=640,
|
| 903 |
total_second_length=5,
|
| 904 |
latent_window_size=9,
|
| 905 |
-
steps=
|
| 906 |
cfg=1.0,
|
| 907 |
gs=10.0,
|
| 908 |
rs=0.0,
|
| 909 |
gpu_memory_preservation=6,
|
| 910 |
-
enable_preview=
|
| 911 |
use_teacache=False,
|
| 912 |
mp4_crf=16,
|
| 913 |
fps_number=30
|
|
|
|
| 416 |
# Combine both image embeddings or use a weighted approach
|
| 417 |
image_encoder_last_hidden_state = (image_encoder_last_hidden_state + end_image_encoder_last_hidden_state) / 2
|
| 418 |
|
| 419 |
+
# Clean GPU
|
| 420 |
+
if not high_vram:
|
| 421 |
+
unload_complete_models(
|
| 422 |
+
image_encoder
|
| 423 |
+
)
|
| 424 |
+
|
| 425 |
# Dtype
|
| 426 |
image_encoder_last_hidden_state = image_encoder_last_hidden_state.to(transformer.dtype)
|
| 427 |
|
|
|
|
| 431 |
rnd = torch.Generator("cpu").manual_seed(seed)
|
| 432 |
num_frames = latent_window_size * 4 - 3
|
| 433 |
|
| 434 |
+
history_latents = torch.zeros(size=(1, 16, 1 + 2 + 16, height // 8, width // 8), dtype=torch.float32, device=cpu)
|
| 435 |
history_pixels = None
|
| 436 |
total_generated_latent_frames = 0
|
| 437 |
|
|
|
|
| 552 |
history_pixels = soft_append_bcthw(current_pixels, history_pixels, overlapped_frames)
|
| 553 |
|
| 554 |
if not high_vram:
|
| 555 |
+
unload_complete_models(vae)
|
| 556 |
|
| 557 |
output_filename = os.path.join(outputs_folder, f'{job_id}_{total_generated_latent_frames}.mp4')
|
| 558 |
|
|
|
|
| 908 |
resolution=640,
|
| 909 |
total_second_length=5,
|
| 910 |
latent_window_size=9,
|
| 911 |
+
steps=30,
|
| 912 |
cfg=1.0,
|
| 913 |
gs=10.0,
|
| 914 |
rs=0.0,
|
| 915 |
gpu_memory_preservation=6,
|
| 916 |
+
enable_preview=False,
|
| 917 |
use_teacache=False,
|
| 918 |
mp4_crf=16,
|
| 919 |
fps_number=30
|