Report direct sampling progress
This commit is contained in:
parent
eed3a3d951
commit
e5ffacc625
1 changed files with 16 additions and 3 deletions
|
|
@ -1,5 +1,7 @@
|
|||
"""Minimal direct prompt-only H3 video sampler for visual smoke previews."""
|
||||
|
||||
import time
|
||||
|
||||
import torch
|
||||
|
||||
from .packing import H3PromptPacker, unpatchify_video
|
||||
|
|
@ -52,8 +54,12 @@ def sample_video_res_multistep(model, packer: H3PromptPacker, text: torch.Tensor
|
|||
audio_carried = audio * 4.0
|
||||
video_history = audio_history = None
|
||||
video_history_sigma = audio_history_sigma = None
|
||||
for index, sigma in enumerate(sigmas[:-1]):
|
||||
sigma_down = sigmas[index + 1]
|
||||
total_steps = len(sigmas) - 1
|
||||
started = time.perf_counter()
|
||||
for index, sigma in enumerate(sigmas[:-1], start=1):
|
||||
step_started = time.perf_counter()
|
||||
previous_index = index - 1
|
||||
sigma_down = sigmas[index]
|
||||
sigma_audio = _audio_sigma(sigma)
|
||||
native_audio = audio_carried * (sigma_audio / sigma)
|
||||
hidden, times, segments, positions, video_segment, audio_segment = packer(text, video, native_audio, float(sigma))
|
||||
|
|
@ -64,11 +70,18 @@ def sample_video_res_multistep(model, packer: H3PromptPacker, text: torch.Tensor
|
|||
velocity_audio = (1.0 - 4.0) * (audio_carried * carry) + (1.0 + 3.0 * sigma_audio) * velocity_audio_native
|
||||
video_denoised = video - sigma * velocity_video
|
||||
audio_denoised = audio_carried - sigma * velocity_audio
|
||||
previous_sigma = sigmas[index - 1] if index else None
|
||||
previous_sigma = sigmas[previous_index - 1] if previous_index else None
|
||||
video = res_multistep_update(video, video_denoised, sigma, sigma_down, video_history, video_history_sigma, previous_sigma)
|
||||
audio_carried = res_multistep_update(audio_carried, audio_denoised, sigma, sigma_down, audio_history, audio_history_sigma, previous_sigma)
|
||||
video_history, audio_history = video_denoised, audio_denoised
|
||||
video_history_sigma = audio_history_sigma = sigma_down
|
||||
elapsed = time.perf_counter() - started
|
||||
eta = elapsed / index * (total_steps - index)
|
||||
print(
|
||||
f"sampling step {index}/{total_steps}: "
|
||||
f"{time.perf_counter() - step_started:.1f}s, elapsed {elapsed:.1f}s, eta {eta:.1f}s",
|
||||
flush=True,
|
||||
)
|
||||
return video
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue