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.

Keep an idle engine when its own pinned weights already cover the next request's host cache

Bowen Xueafba5fc1f3c1
diff --git a/freevideo_engine/resident_models.py b/freevideo_engine/resident_models.py
index 185f01c..ebf82e4 100644
--- a/freevideo_engine/resident_models.py
+++ b/freevideo_engine/resident_models.py
@@ -271,15 +271,22 @@ class ModelBank:
The RAM guard counts the whole session, so retained engine weights
plus the next encoder's start (about 8 GiB) must stay inside the
- budget, and so must the host weights a fresh plan would pin: measured,
- a retained copy left no room to pin and sampling took 95 s instead of
- 38 s. Otherwise the engine goes as it did with one worker per request.
+ budget, and so must the host weights a fresh plan would pin beyond those
+ the engine already holds: measured, a retained copy left no room to
+ pin and sampling took 95 s instead of 38 s. Otherwise the engine goes
+ as it did with one worker per request.
"""
- if not self.ram_fits(8*GiB + int(pinned)):
+ # A retained engine's pinned weights are reused by the next request
+ # rather than pinned again, so they count once, in the session's use.
+ held = sum(pinned_cpu_storages(self.entries['engine']['model']).values()) if 'engine' in self.entries else 0
+ need = 8*GiB + max(0, int(pinned) - held)
+ if not self.ram_fits(need):
self.converted_store.clear()
for role in ('engine', 'encoder'):
- if role in self.entries and not self.ram_fits(8*GiB + int(pinned)):
+ if role in self.entries and not self.ram_fits(need):
self.drop(role, 'Retained weights leave no host room for the next request')
+ if role == 'engine':
+ need = 8*GiB + int(pinned)
gc.collect()
try:
import ctypes