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.
Run the small CPU table work of AdaLN loading on one thread so it no longer stalls on a busy host
Bowen Xueb93e6a6206cb
diff --git a/freevideo_engine/adaln.py b/freevideo_engine/adaln.pyindex 4fbbea8..b45a56f 100644--- a/freevideo_engine/adaln.py+++ b/freevideo_engine/adaln.py@@ -4,6 +4,7 @@ The optimization is inspired by NVIDIA's Sol-H3 AdaLN precompute: timesteps areknown before sampling, so retain the small modulation outputs instead of 26 GBof immutable projection weights. FL2VA has a separate keyframe timestep schedule."""+import contextlibimport hashlibimport jsonfrom pathlib import Path@@ -12,6 +13,24 @@ from safetensors.torch import load_file, save_fileimport torch+def serial_ops():+ """Run the small CPU tensor work of a table on this thread alone.++ A table is a few hundred kilobytes. Spread over the full intra-op pool each+ operation waits for its workers, and on a machine whose cores are busy that+ wait is hundreds of times the work (about 0.3 s per block for a cat that+ takes 0.2 ms alone). The thread count is a setting of the whole process, so+ it is restored on exit and other threads running torch ops meanwhile see 1.+ """+ previous = torch.get_num_threads()+ torch.set_num_threads(1)+ try:+ yield+ finally:+ torch.set_num_threads(previous)++def all_finite(tensor):"""Whether every element is finite; reads half-precision bits instead of calling isfinite.@@ -50,8 +69,9 @@ class CachedModulation(torch.nn.Module):super().__init__()self.cursor = cursorself.steps = len(values)- for index, values_at_step in enumerate(values):- self.register_buffer(f'step_{index}', torch.cat(values_at_step, dim=-1))+ with serial_ops():+ for index, values_at_step in enumerate(values):+ self.register_buffer(f'step_{index}', torch.cat(values_at_step, dim=-1))# Steps differ in how many distinct timesteps they carry: the first H3# step has video and audio at the same t, so its rows are fewer. The# fused pre/post kernels compile for static shapes and recompiled in the@@ -188,7 +208,9 @@ class TableCache:# These are small immutable constants; their producer's GPU/runtime is# deliberately irrelevant. Validate before transferring to this device.state = load_file(path, device=self.device)- if any(not all_finite(tensor) for tensor in state.values()):+ with serial_ops():+ finite = all(all_finite(tensor) for tensor in state.values())+ if not finite:raise ValueError('Nonfinite AdaLN model asset')return [state[f'step_{i}'].chunk(6, dim=-1) for i in range(steps)]