Add logs
Browse files- app_endframe.py +9 -8
app_endframe.py
CHANGED
|
@@ -498,7 +498,6 @@ def worker(input_video, end_frame, end_frame_weight, prompt, n_prompt, seed, bat
|
|
| 498 |
effective_clean_frames = max(0, num_clean_frames - 1) if num_clean_frames > 1 else 1
|
| 499 |
if is_start_of_video:
|
| 500 |
effective_clean_frames = 1 # avoid jumpcuts from input video
|
| 501 |
-
print(f"££££££££££££££££££££££££££ is_start_of_video: {is_start_of_video} latent_padding: {latent_padding} effective_clean_frames: {effective_clean_frames}")
|
| 502 |
clean_latent_pre_frames = effective_clean_frames
|
| 503 |
num_2x_frames = min(2, max(1, available_frames - clean_latent_pre_frames - 1)) if available_frames > clean_latent_pre_frames + 1 else 1
|
| 504 |
num_4x_frames = min(16, max(1, available_frames - clean_latent_pre_frames - num_2x_frames)) if available_frames > clean_latent_pre_frames + num_2x_frames else 1
|
|
@@ -555,7 +554,7 @@ def worker(input_video, end_frame, end_frame_weight, prompt, n_prompt, seed, bat
|
|
| 555 |
clean_latents = torch.cat([clean_latents_pre, clean_latents_post], dim=2)
|
| 556 |
|
| 557 |
max_frames = min(latent_window_size * 4 - 3, history_latents.shape[2] * 4)
|
| 558 |
-
|
| 559 |
generated_latents = sample_hunyuan(
|
| 560 |
transformer=transformer,
|
| 561 |
sampler='unipc',
|
|
@@ -598,8 +597,10 @@ def worker(input_video, end_frame, end_frame_weight, prompt, n_prompt, seed, bat
|
|
| 598 |
|
| 599 |
real_history_latents = history_latents[:, :, :total_generated_latent_frames, :, :]
|
| 600 |
if history_pixels is None:
|
|
|
|
| 601 |
history_pixels = vae_decode(real_history_latents, vae).cpu()
|
| 602 |
else:
|
|
|
|
| 603 |
section_latent_frames = (latent_window_size * 2 + 1) if is_start_of_video else (latent_window_size * 2)
|
| 604 |
overlapped_frames = latent_window_size * 4 - 3
|
| 605 |
current_pixels = vae_decode(real_history_latents[:, :, :section_latent_frames], vae).cpu()
|
|
@@ -610,9 +611,9 @@ def worker(input_video, end_frame, end_frame_weight, prompt, n_prompt, seed, bat
|
|
| 610 |
|
| 611 |
output_filename = os.path.join(outputs_folder, f'{job_id}_{total_generated_latent_frames}.mp4')
|
| 612 |
save_bcthw_as_mp4(history_pixels, output_filename, fps=fps, crf=mp4_crf)
|
| 613 |
-
|
| 614 |
set_mp4_comments_imageio_ffmpeg(output_filename, f"Prompt: {prompt} | Negative Prompt: {n_prompt}")
|
| 615 |
-
|
| 616 |
|
| 617 |
if previous_video is not None and os.path.exists(previous_video):
|
| 618 |
try:
|
|
@@ -622,7 +623,7 @@ def worker(input_video, end_frame, end_frame_weight, prompt, n_prompt, seed, bat
|
|
| 622 |
print(f"Error deleting previous partial video {previous_video}: {e}")
|
| 623 |
previous_video = output_filename
|
| 624 |
|
| 625 |
-
|
| 626 |
stream.output_queue.push(('file', output_filename))
|
| 627 |
|
| 628 |
if is_start_of_video:
|
|
@@ -634,9 +635,9 @@ def worker(input_video, end_frame, end_frame_weight, prompt, n_prompt, seed, bat
|
|
| 634 |
|
| 635 |
output_filename = os.path.join(outputs_folder, f'{job_id}_final.mp4')
|
| 636 |
save_bcthw_as_mp4(history_pixels, output_filename, fps=fps, crf=mp4_crf)
|
| 637 |
-
|
| 638 |
set_mp4_comments_imageio_ffmpeg(output_filename, f"Prompt: {prompt} | Negative Prompt: {n_prompt}")
|
| 639 |
-
|
| 640 |
stream.output_queue.push(('file', output_filename))
|
| 641 |
|
| 642 |
if previous_video is not None and os.path.exists(previous_video):
|
|
@@ -647,7 +648,7 @@ def worker(input_video, end_frame, end_frame_weight, prompt, n_prompt, seed, bat
|
|
| 647 |
print(f"Error deleting previous partial video {previous_video}: {e}")
|
| 648 |
previous_video = output_filename
|
| 649 |
|
| 650 |
-
|
| 651 |
|
| 652 |
stream.output_queue.push(('file', output_filename))
|
| 653 |
|
|
|
|
| 498 |
effective_clean_frames = max(0, num_clean_frames - 1) if num_clean_frames > 1 else 1
|
| 499 |
if is_start_of_video:
|
| 500 |
effective_clean_frames = 1 # avoid jumpcuts from input video
|
|
|
|
| 501 |
clean_latent_pre_frames = effective_clean_frames
|
| 502 |
num_2x_frames = min(2, max(1, available_frames - clean_latent_pre_frames - 1)) if available_frames > clean_latent_pre_frames + 1 else 1
|
| 503 |
num_4x_frames = min(16, max(1, available_frames - clean_latent_pre_frames - num_2x_frames)) if available_frames > clean_latent_pre_frames + num_2x_frames else 1
|
|
|
|
| 554 |
clean_latents = torch.cat([clean_latents_pre, clean_latents_post], dim=2)
|
| 555 |
|
| 556 |
max_frames = min(latent_window_size * 4 - 3, history_latents.shape[2] * 4)
|
| 557 |
+
print(f"Generating video {idx+1} of {batch} with seed {seed}, part {total_latent_sections - section_index} of {total_latent_sections} backward")
|
| 558 |
generated_latents = sample_hunyuan(
|
| 559 |
transformer=transformer,
|
| 560 |
sampler='unipc',
|
|
|
|
| 597 |
|
| 598 |
real_history_latents = history_latents[:, :, :total_generated_latent_frames, :, :]
|
| 599 |
if history_pixels is None:
|
| 600 |
+
print("£££££££££££££££££££££££££££££££")
|
| 601 |
history_pixels = vae_decode(real_history_latents, vae).cpu()
|
| 602 |
else:
|
| 603 |
+
print("€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€")
|
| 604 |
section_latent_frames = (latent_window_size * 2 + 1) if is_start_of_video else (latent_window_size * 2)
|
| 605 |
overlapped_frames = latent_window_size * 4 - 3
|
| 606 |
current_pixels = vae_decode(real_history_latents[:, :, :section_latent_frames], vae).cpu()
|
|
|
|
| 611 |
|
| 612 |
output_filename = os.path.join(outputs_folder, f'{job_id}_{total_generated_latent_frames}.mp4')
|
| 613 |
save_bcthw_as_mp4(history_pixels, output_filename, fps=fps, crf=mp4_crf)
|
| 614 |
+
print(f"Latest video saved: {output_filename}")
|
| 615 |
set_mp4_comments_imageio_ffmpeg(output_filename, f"Prompt: {prompt} | Negative Prompt: {n_prompt}")
|
| 616 |
+
print(f"Prompt saved to mp4 metadata comments: {output_filename}")
|
| 617 |
|
| 618 |
if previous_video is not None and os.path.exists(previous_video):
|
| 619 |
try:
|
|
|
|
| 623 |
print(f"Error deleting previous partial video {previous_video}: {e}")
|
| 624 |
previous_video = output_filename
|
| 625 |
|
| 626 |
+
print(f'Decoded. Current latent shape {real_history_latents.shape}; pixel shape {history_pixels.shape}')
|
| 627 |
stream.output_queue.push(('file', output_filename))
|
| 628 |
|
| 629 |
if is_start_of_video:
|
|
|
|
| 635 |
|
| 636 |
output_filename = os.path.join(outputs_folder, f'{job_id}_final.mp4')
|
| 637 |
save_bcthw_as_mp4(history_pixels, output_filename, fps=fps, crf=mp4_crf)
|
| 638 |
+
print(f"Final video with input blend saved: {output_filename}")
|
| 639 |
set_mp4_comments_imageio_ffmpeg(output_filename, f"Prompt: {prompt} | Negative Prompt: {n_prompt}")
|
| 640 |
+
print(f"Prompt saved to mp4 metadata comments: {output_filename}")
|
| 641 |
stream.output_queue.push(('file', output_filename))
|
| 642 |
|
| 643 |
if previous_video is not None and os.path.exists(previous_video):
|
|
|
|
| 648 |
print(f"Error deleting previous partial video {previous_video}: {e}")
|
| 649 |
previous_video = output_filename
|
| 650 |
|
| 651 |
+
print(f'Decoded. Current latent shape {real_history_latents.shape}; pixel shape {history_pixels.shape}')
|
| 652 |
|
| 653 |
stream.output_queue.push(('file', output_filename))
|
| 654 |
|