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-warm release: hold the start lock and free the card in order
Bowen Xue68fe2cce0f56
diff --git a/freevideo_engine/agent/jobs.py b/freevideo_engine/agent/jobs.pyindex 46cae3b..649d4af 100644--- a/freevideo_engine/agent/jobs.py+++ b/freevideo_engine/agent/jobs.py@@ -713,11 +713,14 @@ class Jobs:elif save:self.retry_pending()return- row.update(status=status, finished_at=self.clock(), updated_at=self.clock())if row['kind'] == 'generate' and row.get('spec', {}).get('release_gpu_after') is True:- # The agent runs another model on this card next. Off the lock: stopping the worker takes a moment.+ # The agent runs another model on this card next, so the card is free before the job reads as done.from ..resident_process import OWNER- threading.Thread(target=OWNER.release_idle, args=('agent_requested',), name='freevideo-release-gpu', daemon=True).start()+ try:+ OWNER.release_idle('agent_requested')+ except Exception:+ pass+ row.update(status=status, finished_at=self.clock(), updated_at=self.clock())if result is not None:row['result'] = resultif error is not None:diff --git a/freevideo_engine/comfy_bridge.py b/freevideo_engine/comfy_bridge.pyindex 1c192bb..395c2c8 100644--- a/freevideo_engine/comfy_bridge.py+++ b/freevideo_engine/comfy_bridge.py@@ -1551,8 +1551,7 @@ def generate(prompt, width, height, seconds, seed, output_directory, *,OWNER.close()environment.pop(ENV, None)else:- environment[ENV] = OWNER.start(root, source, machine['python'], environment)- OWNER.active = True+ environment[ENV] = OWNER.start(root, source, machine['python'], environment, busy=True)with (run / 'generate.log').open('wb') as log:process = processes.popen(command, env=environment, cwd=source, stdin=subprocess.DEVNULL,stdout=log, stderr=subprocess.STDOUT, start_new_session=True, supervise=True)diff --git a/freevideo_engine/resident_process.py b/freevideo_engine/resident_process.pyindex 1720dd3..d125b8d 100644--- a/freevideo_engine/resident_process.py+++ b/freevideo_engine/resident_process.py@@ -394,6 +394,8 @@ class SessionOwner:hold = min(HOLD_SECONDS, AGENT_HOLD_SECONDS) if agent else HOLD_SECONDSif not next_part and warm and gpu_used(gpu) is not None:hold, next_part = KEEP_IDLE_SECONDS, 'warm'+ else:+ warm = Falseif not next_part or hold <= 0:return self.release('finished' if not next_part else 'no_hold')reason = pressure(gpu, None) or self._tight()@@ -402,6 +404,8 @@ class SessionOwner:self.generation += 1self.idle_since = time.monotonic()baseline = gpu_used(gpu)+ if warm and baseline is None:+ return self.release('gpu_unreadable')threading.Thread(target=self._watch, args=(self.generation, self.idle_since, hold, gpu, baseline),name='freevideo-resident-hold', daemon=True).start()return self.record(action='kept', reason=next_part, seconds=hold, pid=self.process.pid)@@ -459,11 +463,15 @@ class SessionOwner:self.close()return self.record(**row)- def start(self, root, source, python, environment):+ def start(self, root, source, python, environment, busy=False):with self.mutex:self.generation += 1self.idle_since = None- return self._start(root, source, python, environment)+ endpoint = self._start(root, source, python, environment)+ # Marked under the same lock, so a release cannot land between starting and using the worker.+ if busy:+ self.active = True+ return endpointdef _start(self, root, source, python, environment):import hashlib@@ -567,7 +575,9 @@ def pressure(gpu, baseline):if baseline is not None:# The idle worker does not allocate, so growth on the card is another program's.used = gpu_used(gpu)- if used is not None and used - baseline >= OTHER_GPU_GROWTH:+ if used is None:+ return 'gpu_unreadable'+ if used - baseline >= OTHER_GPU_GROWTH:return 'other_program_gpu'return None