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.

Image generation counts loaded weights that could not be page-locked as already held host memory

Bowen Xue7d9a11e3befb
diff --git a/freevideo_engine/image_gen/image_runner.py b/freevideo_engine/image_gen/image_runner.py
index e826f0d..593a0db 100644
--- a/freevideo_engine/image_gen/image_runner.py
+++ b/freevideo_engine/image_gen/image_runner.py
@@ -126,7 +126,7 @@ class ImageRunner:
self.shape = image_policy.ImageShape.measure(
list(self.transformer.transformer_blocks), list(language.layers),
- total_weight_bytes=self.dit_stack.pinned_bytes + self.te_stack.pinned_bytes)
+ total_weight_bytes=self.dit_stack.host_bytes + self.te_stack.host_bytes)
self.generator = QwenImageGenerator(
None, placement=_Placement(self), device=self.device, transformer=self.transformer, vae=self.vae,
text_encoder=text, processor=processor, sample_sigmas=None, vae_tile=True)
@@ -160,8 +160,16 @@ class ImageRunner:
scale = (resolution * resolution / (image.width * image.height)) ** 0.5
reference_pixels += round(image.width * scale) * round(image.height * scale)
try:
- from ..offload import live_pin_capacity
- host_available = live_pin_capacity() + self.dit_stack.pinned_bytes + self.te_stack.pinned_bytes
+ # The weights are loaded by now, so what is left to find is the request's
+ # working memory. Credit what the weights already hold, locked or not, and
+ # read free RAM itself: the locked-page budget (half of RAM on Windows)
+ # and its headroom only limit pinning, which happened at load. Gating on
+ # them refused every request on a 28 GB Windows machine, the second one
+ # after a first had just been made at the same size.
+ from ..system import system_memory
+ memory = system_memory()
+ free = memory.get('physical_available_bytes') or memory['available_bytes']
+ host_available = free + self.dit_stack.host_bytes + self.te_stack.host_bytes
except Exception:
host_available = None
return image_policy.plan_image(
diff --git a/freevideo_engine/image_gen/image_stream.py b/freevideo_engine/image_gen/image_stream.py
index d9836a2..7b783a5 100644
--- a/freevideo_engine/image_gen/image_stream.py
+++ b/freevideo_engine/image_gen/image_stream.py
@@ -21,6 +21,10 @@ class StreamedStack:
self.layers = list(layers)
if not self.layers:
raise ValueError('StreamedStack needs at least one layer')
+ # Host bytes of every layer, pinned or not: the weights hold this much of
+ # the host whichever storage they ended up on.
+ self.host_bytes = sum(tensor.numel() * tensor.element_size() for layer in self.layers
+ for tensor in list(layer.parameters()) + list(layer.buffers()))
# Pinning is an optimization: a host that refuses it costs transfer
# speed, not the request (pin_layer_weights keeps the unpinned layers
# on their ordinary storage and the offloader stages them).