Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

Make the decode reduction order fixed

Bowen Xue6cd7ca4329cf
diff --git a/freevideo_engine/vae_tiles.py b/freevideo_engine/vae_tiles.py
index 37f12e3..5b8223c 100644
--- a/freevideo_engine/vae_tiles.py
+++ b/freevideo_engine/vae_tiles.py
@@ -34,11 +34,26 @@ def compile_blocks(decoder):
return False
for block in decoder.transformer_blocks:
if not getattr(block, 'freevideo_compiled', False):
- block.forward = torch.compile(block.forward, dynamic=False)
+ block.forward = _fixed_reduction_order(torch.compile(block.forward, dynamic=False))
block.freevideo_compiled = True
return True
+def _fixed_reduction_order(compiled):
+ """Run the compiled block with Inductor's deterministic mode.
+
+ Otherwise Inductor times several warp counts for each fused RMSNorm reduction
+ when a process first runs the block, and the counts sum in different orders.
+ About 1 process in 20 then decoded the same latents to pixels that differ by one
+ 8-bit level in 0.3% of values; 150 processes in this mode gave identical output.
+ """
+ def forward(*args, **kwargs):
+ from torch._inductor import config
+ with config.patch(deterministic=True):
+ return compiled(*args, **kwargs)
+ return forward
+
+
class TileDecoder:
def __init__(self, decoder, prefetch=True, weight_source=None, resident_blocks=0):
self.decoder = decoder