Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions minimax-h3/h3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1539,24 +1539,26 @@ async def vae_round_trip(
frames = steps // LATENTS_PER_CHUNK * FRAMES_PER_CHUNK + 5
kept: list[Tensor] = []
index: list[int] = []
# The decode lands each chunk's RGB8 frames on the host and nothing else: the MP4 is written after it (`save_video`),
# so `vae_decode` times the VAE, not a host's video encoder running beside it (gate 44090355818's pod: 7.8 s, 4.5 s on
# another), as ComfyUI's VAEDecode is timed.
landed: list[Tensor] = []
with tel.stage("vae_decode"):
stream = _VideoStream(torch, out, frames=frames, waveform=None, sample_rate=0, cancel=ctx.raise_if_cancelled,
progress=ctx.progress) # fmt: skip

def push(chunk: Tensor) -> None:
first = stream.landed
first = sum(int(piece.shape[0]) for piece in landed)
for at in range(-first % _KEPT_EVERY, int(chunk.shape[0]), _KEPT_EVERY):
kept.append(chunk[at].float().cpu())
index.append(first + at)
stream.push(chunk)
landed.append(chunk.clamp(0, 1).mul(255).round().to(torch.uint8).cpu())

try:
base_model.decode_latents(latents.to(str(base_model.device), torch.float32), on_chunk=push)
except BaseException:
stream.abandon()
raise
base_model.decode_latents(latents.to(str(base_model.device), torch.float32), on_chunk=push)
stream = _VideoStream(torch, out, frames=frames, waveform=None, sample_rate=0, cancel=ctx.raise_if_cancelled,
progress=ctx.progress) # fmt: skip
try:
with tel.stage("save_video"):
for piece in landed:
stream.push(piece.float().div_(255))
saved = stream.finish(ctx.progress)
except BaseException:
stream.abandon()
Expand Down
2 changes: 1 addition & 1 deletion minimax-h3/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "minimax-h3"
version = "0.16.0rc1"
version = "0.16.0rc2"
description = "MiniMax H3 video with sound: a shot of any length, an edit of a plate, and its upscale"
requires-python = ">=3.12,<3.15"
dependencies = [
Expand Down
2 changes: 1 addition & 1 deletion minimax-h3/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.