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 updates started from the page and hash torch sources while models load (#25)

Bowen Xuee4c7c537fa2a
diff --git a/freevideo_engine/launcher/Main.qml b/freevideo_engine/launcher/Main.qml
index 9cfafe6..bdb78b9 100644
--- a/freevideo_engine/launcher/Main.qml
+++ b/freevideo_engine/launcher/Main.qml
@@ -847,7 +847,9 @@ ApplicationWindow {
id: updateDialog; visible: !s.busy && (s.update.remind || manualUpdate)
objectName: "updateDialog"
width: Math.min(540,win.width-40); closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
- onClosed: { manualUpdate = false; backend.dismissUpdate() }
+ // State changes also close it (an update started from the banner or a
+ // page, or a task began); only a user dismissal counts as "Later".
+ onClosed: { if (!s.busy && (s.update.remind || manualUpdate)) backend.dismissUpdate(); manualUpdate = false }
height: Math.min(updateContents.implicitHeight + padding*2, win.height-48)
contentItem: ScrollView {
id: updateScroll; clip: true; contentWidth: availableWidth
diff --git a/freevideo_engine/launcher_session.py b/freevideo_engine/launcher_session.py
index 6fb8fbd..3d59b4c 100644
--- a/freevideo_engine/launcher_session.py
+++ b/freevideo_engine/launcher_session.py
@@ -535,7 +535,7 @@ class Session:
elif self.update_intent == 'launcher' and updater and not updater.busy:
if row.get('status') == 'ready':
self._restart_when_idle()
- else:
+ elif row.get('status') != 'downloading':
self.update_intent, self.update_waiting = None, False
elif self.update_intent == 'engine':
self._update_engine_when_idle()
diff --git a/freevideo_engine/worker.py b/freevideo_engine/worker.py
index 4d7210e..e9a9f68 100644
--- a/freevideo_engine/worker.py
+++ b/freevideo_engine/worker.py
@@ -3,6 +3,7 @@ import argparse
import json
import os
from pathlib import Path
+import threading
import time
import torch
@@ -24,6 +25,32 @@ def main():
generate(request)
+def prefetch_compiler_keys():
+ """Hash the installed torch and Triton sources while models load.
+
+ The first torch.compile in a process hashes every installed torch source
+ file into its cache key; on Windows with real-time scanning that took
+ 7-8 s of the first sampling step. torch caches the value per process and
+ can compute it ahead; the keys themselves are unchanged."""
+ def work():
+ try:
+ from torch._inductor import codecache
+ except Exception:
+ return
+ for key in (getattr(codecache, 'torch_key', None), getattr(codecache, 'triton_key', None)):
+ try:
+ prefetch = getattr(key, 'prefetch', None)
+ if callable(prefetch):
+ prefetch()
+ elif callable(key):
+ key()
+ except Exception:
+ pass # The first compile computes it as before.
+ thread = threading.Thread(target=work, name='freevideo-compiler-keys', daemon=True)
+ thread.start()
+ return thread
+
+
def device_memory_report(budget_bytes, allocator_limit_bytes=None, *, reserve_bytes=0, capacity_trial=False):
from .gpu_budget import configure
return configure(torch, budget_bytes, allocator_limit_bytes, reserve_bytes=reserve_bytes,
@@ -33,6 +60,7 @@ def device_memory_report(budget_bytes, allocator_limit_bytes=None, *, reserve_by
def generate(request, resident=None):
torch.set_num_threads(8)
started = time.perf_counter()
+ prefetch_compiler_keys()
engine = None
live_budget = None
decode_read_ahead = None