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.

Install progress card names the step it is on

Bowen Xue28228152e9a1
diff --git a/freevideo_engine/bootstrap.py b/freevideo_engine/bootstrap.py
index 1363e97..8c29a70 100644
--- a/freevideo_engine/bootstrap.py
+++ b/freevideo_engine/bootstrap.py
@@ -396,7 +396,36 @@ def offline_installation(root):
return (root.parent / 'portable.json').is_file()
-def plan(args, *, local_progress=None):
+PREPARE_KEY = 'install-prepare'
+
+
+def prepare_step(ui, name, done=None, total=None):
+ """One running task for the silent steps between the model scan and the first real task.
+
+ Without it the card keeps the last finished event (the model scan) for as long as the
+ environment, the network and the download tools are examined.
+ """
+ with ui._lock:
+ if PREPARE_KEY not in ui.tasks:
+ ui.begin(PREPARE_KEY, 'Preparing installation')
+ elif ui.tasks[PREPARE_KEY]['state'] != 'running':
+ return # Finished: a late step must not bring the card back to it.
+ if ui.tasks[PREPARE_KEY].get('step') != name:
+ ui.tasks[PREPARE_KEY]['event_tick'] = 0. # Short steps must each reach the card.
+ ui.tasks[PREPARE_KEY]['step'] = name
+ shown = '%s %d / %d' % (name, done or 0, total) if total else name
+ ui.update(PREPARE_KEY, activity='note', name=shown, detail=shown, unit='items',
+ done=done or 0, total=total or 0)
+
+
+def prepare_end(ui, success=True):
+ """Finish the step once; a repeated end would bring its finished line back as the card's last event."""
+ with ui._lock:
+ if ui.tasks.get(PREPARE_KEY, {}).get('state') == 'running':
+ ui.end(PREPARE_KEY, success=success)
+
+
+def plan(args, *, local_progress=None, stage=None):
root = args.root.expanduser().resolve()
saved = json.loads((root / 'machine.json').read_text(encoding='utf-8')) if (root / 'machine.json').is_file() else {}
storage = getattr(args, 'storage', None) or saved.get('storage', 'compact')
@@ -569,6 +598,8 @@ def plan(args, *, local_progress=None):
# Stream directly into final FP8 groups. The pinned model occupies ~45.3
# GiB; allow 52 GiB including the largest group in progress. Never credit
# future source deletion toward the space needed to complete conversion.
+ if stage:
+ stage('Checking the environment')
dependencies = dependency_status(root, layout, system)
environments_ready = all(r['exists'] and not r['missing'] and not r['mismatched'] for r in dependencies.values())
python_version = None if mac_target else bootstrap_versions(
@@ -592,6 +623,8 @@ def plan(args, *, local_progress=None):
errors.extend(disk_plan['errors'])
# A repair also reinstalls what is damaged in the ComfyUI environment the launcher made.
frontend_python = getattr(args, 'frontend_repair_python', None)
+ if stage:
+ stage('Checking the environment')
package_download_bytes = reinstall_download_bytes(dependencies, system, root=root,
frontend_python=str(frontend_python.expanduser().absolute()) if frontend_python else None,
disk_mode=disk_plan['mode'])
@@ -600,18 +633,23 @@ def plan(args, *, local_progress=None):
if reuse_cache and not cache_compatible(reuse_cache, **cache_format):
errors.append('--cache must contain a prepared FP8 cache compatible with this GPU scale format.')
from .download_settings import read as download_preferences
+ if stage:
+ stage('Testing download sources')
networking = network.plan(json.loads((PACKAGE / 'dependencies.json').read_text(encoding='utf-8')),
bootstrap_versions(json.loads((PACKAGE / 'bootstrap_versions.json').read_text(encoding='utf-8')), system), layout,
mode=getattr(args, 'network', 'auto'), timeout=getattr(args, 'network_timeout', 5),
offline=bool(args.hardware_json or errors),
env=dict(os.environ, FREEVIDEO_HOME=str(root)),
- proxy_mode=download_preferences(root / 'download-settings.json')['proxy_mode'])
+ proxy_mode=download_preferences(root / 'download-settings.json')['proxy_mode'],
+ progress=(lambda message: stage('Testing download sources', message['done'], message['total'])) if stage else None)
networking['download_settings_path'] = str(root / 'download-settings.json')
prepared_missing = prepared and any(
not model_target(row, model_dir, encoder_dir, prepared_dir).is_file()
for row in files if row.get('prepared') and not
(local_reuse or {}).get('matches', {}).get(row['repo'] + '/' + row['file']))
if prepared_missing and not args.hardware_json and not errors:
+ if stage:
+ stage('Testing download sources')
error = prepared_model.access_error(prepared, networking)
if error:
errors.append(error)
@@ -1058,6 +1096,8 @@ class Installer:
self.damaged_before = []
if self.system != 'Darwin' and self.pythons['engine'].is_file():
from .runtime_libraries import damaged
+ if ui is not None:
+ prepare_step(ui, 'Checking the environment')
self.damaged_before = damaged(self.pythons['engine'])
# Moving a working installation to int8 checks the int8 kernels first
# (execute), so a GPU that fails them keeps its configuration as it was.
@@ -1799,6 +1839,7 @@ class Installer:
require_int8_kernels(self.plan, report)
self.mark_unfinished()
self.ui.phase('Prepare download tools', 0, 8)
+ prepare_step(self.ui, 'Preparing download tools')
uv = self.prepare_tools()
self.env['FREEVIDEO_UV'] = str(uv)
from .install_schedule import run
@@ -1814,6 +1855,7 @@ class Installer:
weighted['shown'] = done = max(weighted['shown'], 1 + units)
self.ui.phase(phase, done, total)
def scheduling(name, status, completed, count):
+ prepare_end(self.ui) # The first real task shows from here on.
with self.state_lock:
self.state.setdefault('schedule', {})[name] = dict(status=status, after=tasks[name]['after'],
exclusive_writers=tasks[name]['writes'], epoch=time.time())
@@ -1943,6 +1985,16 @@ def run_prefetch(value, ui):
def main(argv=None):
+ shown = []
+ try:
+ return run_main(argv, shown)
+ finally:
+ # An interrupt or an unexpected error anywhere must not leave the step running on the card.
+ for ui in shown:
+ prepare_end(ui, False)
+
+
+def run_main(argv, shown):
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--root', type=Path, default=Path(os.environ.get('FREEVIDEO_HOME', DEFAULT_ROOT)))
parser.add_argument('--gpu', help='Physical nvidia-smi index or full GPU UUID')
@@ -2011,6 +2063,7 @@ def main(argv=None):
parser.error('--prefetch-only needs --prepared-format int8 or fp8')
ui = TerminalUI(platform.system() + ' setup', plain=args.plain, no_color=args.no_color,
verbose=args.verbose, show_location=args.verbose)
+ shown.append(ui)
try:
from .local_models import progress_output
if platform.system() == 'Windows' and not args.plan:
@@ -2018,27 +2071,34 @@ def main(argv=None):
def curl_progress(message):
print(json.dumps(message), flush=True)
os.environ['FREEVIDEO_CURL'] = execution_paths.execution_path(ensure(args.root, progress=curl_progress))
- value = plan(args, local_progress=progress_output if os.environ.get('FREEVIDEO_UI_EVENTS') == '1' or not args.json else None)
+ value = plan(args, local_progress=progress_output if os.environ.get('FREEVIDEO_UI_EVENTS') == '1' or not args.json else None,
+ stage=None if args.plan else lambda *step: prepare_step(ui, *step))
except (OSError, RuntimeError, ValueError, subprocess.CalledProcessError) as error:
+ prepare_end(ui, False)
print('Preflight failed: ' + str(error), file=sys.stderr)
return 1
print(json.dumps(value, indent=2)) if args.json else display(value, ui, verbose=args.verbose)
if args.plan:
return 1 if value['errors'] else 0
if value['errors']:
+ prepare_end(ui, False)
return 1
try:
accepted = confirmed(args, value, ui=ui)
except KeyboardInterrupt:
+ prepare_end(ui, False)
print('\nCancelled. No engine or model installation was started.')
return 130
except ValueError as error:
+ prepare_end(ui, False)
print(str(error), file=sys.stderr)
return 1
if not accepted:
+ prepare_end(ui, False)
print('Cancelled. No engine or model installation was started.')
return 0
if args.prefetch_only:
+ prepare_end(ui)
return run_prefetch(value, ui)
try:
installer_class = Installer
@@ -2046,6 +2106,7 @@ def main(argv=None):
from .macos_setup import Installer as installer_class
installer = installer_class(value, ui)
except BlockingIOError:
+ prepare_end(ui, False)
print('Setup, testing or generation is using this installation/GPU lock. Retry after it finishes.', file=sys.stderr)
from .locking import lock_holders
owners = lock_holders([Path(value['root']) / 'setup.lock', os.environ.get('FREEVIDEO_LOCK_PATH', str(Path(value['root']) / 'engine.lock'))])
@@ -2053,6 +2114,7 @@ def main(argv=None):
print('Processes with open lock handles: %s. Stop the old task before retrying; do not delete lock files.' % ', '.join(map(str, owners)), file=sys.stderr)
return 1
except (OSError, ValueError) as error:
+ prepare_end(ui, False)
print('Setup could not start: ' + str(error), file=sys.stderr)
return 1
def interrupted(signum, frame):
@@ -2061,10 +2123,13 @@ def main(argv=None):
try:
ui.start(installer.run_dir)
installer.start_monitor()
+ if value.get('device_backend') == 'mps':
+ prepare_end(ui) # The Mac installer does not schedule through execute() above.
installer.execute()
installer.state['status'] = 'complete'
except BaseException as error:
installer.state.update(status='failed', error='%s: %s' % (type(error).__name__, error))
+ prepare_end(ui, False)
ui.phase('Setup interrupted' if isinstance(error, KeyboardInterrupt) else 'Setup failed', ui.done, ui.total)
finally:
try:
diff --git a/freevideo_engine/launcher_copy.py b/freevideo_engine/launcher_copy.py
index 7878030..08f37af 100644
--- a/freevideo_engine/launcher_copy.py
+++ b/freevideo_engine/launcher_copy.py
@@ -15,6 +15,8 @@ SOURCES = {
ZH = dict([
('Prepare Python', '准备 Python'), ('Install Python', '安装 Python'),
('Prepare download tools', '准备下载工具'), ('Tsinghua mirror', '清华镜像'),
+ ('Preparing installation', '准备安装'), ('Checking the environment', '正在检查运行环境'),
+ ('Testing download sources', '正在测试下载源'), ('Preparing download tools', '正在准备下载工具'),
('GitHub mirror', 'GitHub 镜像'), ('attempt', '正在连接'),
('fallback', '正在切换下载源'), ('route-retry', '正在切换连接'),
('verifying', '正在校验'), ('no-progress', '下载无进展'),
@@ -161,6 +163,7 @@ def display(value, zh=False):
(r'Downloading packages · about (.+) across (\d+) files', r'下载组件 · 约 \1,共 \2 个文件'),
(r'about (.+) across (\d+) files', r'约 \1,共 \2 个文件'),
(r'(\d+) files / folders scanned', r'已扫描 \1 个文件和目录'),
+ (r'Testing download sources (\d+ / \d+)', r'正在测试下载源 \1'),
(r'(\d+ / \d+) files', r'\1 个文件'), (r'shard (\d+ / \d+)', r'分片 \1'),
(r'([\d.]+ MiB) retained', r'已保留 \1'), (r'([\d.]+ GiB) released', r'已释放 \1'),
(r'([\d.]+ MiB) downloaded', r'已下载 \1'),
diff --git a/freevideo_engine/launcher_session.py b/freevideo_engine/launcher_session.py
index 3214463..986f354 100644
--- a/freevideo_engine/launcher_session.py
+++ b/freevideo_engine/launcher_session.py
@@ -1342,6 +1342,10 @@ class Session:
'verifying': ('Downloaded; verifying', '已下载,正在校验'),
'paused': ('Paused', '已暂停')}
review = row.get('status') == 'review'
+ # The model files are checked once the environment is installed; until their step
+ # reports, say that instead of a bare "waiting".
+ before_models = (row.get('action') == 'install' and row.get('status') == 'running'
+ and not (row.get('task', {}).get('model_groups') or row.get('model_groups')))
for name in FAMILIES:
if name == 'sampling' and name not in by_id and not self.form['sampling_caches']:
continue
@@ -1361,8 +1365,12 @@ class Session:
total = item.get('total_bytes', 0)
done = total if state == 'ready' else min(total,
item.get('verified_bytes', 0)+item.get('downloaded_bytes', 0))
+ if state == 'waiting' and before_models:
+ shown = ('Checked after setup', '安装环境后检查')
+ else:
+ shown = states.get(state, states['waiting'])
models.append(dict(id=name, title=self.t(*NAMES[name]), state=state,
- detail=self.t(*states.get(state, states['waiting'])), done=done, total=total,
+ detail=self.t(*shown), done=done, total=total,
found=item.get('existing_bytes', 0), download=item.get('download_bytes', 0),
rate='%.1f MiB/s' % (item['bytes_per_second']/2**20) if item.get('bytes_per_second') else ''))
# A model download names its group, so it shows the group's download, as in the plan and the rows below.
diff --git a/freevideo_engine/progress_timeline.py b/freevideo_engine/progress_timeline.py
index bc755be..bb2bab8 100644
--- a/freevideo_engine/progress_timeline.py
+++ b/freevideo_engine/progress_timeline.py
@@ -168,6 +168,7 @@ LABEL_KEYS = frozenset((
'Prepare ComfyUI environment',
'Prepare FreeVideo',
'Prepare download tools',
+ 'Preparing installation',
'Preparing # s video + audio · # × #',
'Preparing offloaded weight storage',
'Preparing offloaded weight storage · # / # blocks',