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: the GPU acceleration build keeps the step's sentence; a blank line waits to show

Bowen Xuee55235e67b5a
diff --git a/freevideo_engine/launcher_session.py b/freevideo_engine/launcher_session.py
index 378778c..3856bf5 100644
--- a/freevideo_engine/launcher_session.py
+++ b/freevideo_engine/launcher_session.py
@@ -21,7 +21,7 @@ from .launcher_terminal import Tail
from .model_status import FAMILIES, NAMES
from .model_guidance import (package_instructions, video_instructions, runtime_packages_supported, download_view,
export_download_list, DownloadListError, DOWNLOAD_COPY)
-from .setup_progress import ModelLine, progress_text
+from .setup_progress import LineHold, ModelLine, progress_text
from .terminal_ui import clean, duration
from .model_upgrade import TARGET
from .runtime_alias import checked_real_path
@@ -2141,6 +2141,16 @@ class Session:
imported = self.importer.state
file_text = progress_text(dict(activity=imported['activity'], unit='bytes',
name=display('Package files', zh), done=imported.get('activity_done'), total=imported.get('activity_total')), zh)
+ if not hasattr(self, 'line_hold'):
+ self.line_hold = LineHold()
+ detail = clean(progress.get('detail', ''))
+ urgent = (progress.get('notice') or progress.get('activity') == 'resume'
+ or progress.get('state') in ('failed', 'cancelled') or steady == display('Connecting to download server', zh))
+ held = self.line_hold.text(file_text or detail, immediate=bool(urgent), zh=zh)
+ if held != (file_text or detail):
+ file_text, detail = held, ''
+ else:
+ detail = '' if file_text else detail
# The time row's estimate: only while downloading, from what is left at the current speed.
from .setup_progress import number
left, rate = (current.get('total') or 0) - (current.get('done') or 0), current.get('rate')
@@ -2247,7 +2257,7 @@ class Session:
# Qt reads a list as an array; LEVELS is a tuple.
compatibility=dict(self.compatibility, levels=list(self.compatibility.get('levels') or ())),
report=dict(self.report),
- models=models, overall=overall, progress=progress, detail='' if file_text else clean(progress.get('detail', '')),
+ models=models, overall=overall, progress=progress, detail=detail,
progress_text=file_text, remaining_seconds=remaining,
# The elapsed row is only shown while working. An idle clock would
# keep publishing changed snapshots after a launch has failed.
diff --git a/freevideo_engine/setup_progress.py b/freevideo_engine/setup_progress.py
index a882d20..3907b94 100644
--- a/freevideo_engine/setup_progress.py
+++ b/freevideo_engine/setup_progress.py
@@ -18,6 +18,9 @@ VERB_ACTIVITIES = ('verify', 'assemble', 'copy_bytes', 'check', 'copy', 'downloa
COMPONENT_NAMES = ('Video ', 'Text ', 'Sampling ', 'Image ', 'Model', 'Runtime components')
+RUNTIME_NAME = 'Runtime components'
+
+
class ProgressState:
def __init__(self):
self.phase = {}
@@ -25,6 +28,8 @@ class ProgressState:
self.last = {}
self.model_groups = []
self.download_notices = {}
+ self.runtime_parts = {}
+ self.runtime_total = self.runtime_done = 0
def update(self, event, now=None):
now = time.monotonic() if now is None else now
@@ -52,6 +57,13 @@ class ProgressState:
state = event.get('state', 'running')
self.tasks[key] = dict(previous, **event, observed_at=now)
self.tasks[key]['state'] = state
+ row = self.tasks[key]
+ if row.get('name') == RUNTIME_NAME and row.get('unit') == 'bytes' and number(row.get('total')) and row['total'] > 0:
+ self.runtime_parts[row.get('scope') or key] = (min(row.get('done') or 0, row['total']), row['total'])
+ # Wheels download side by side, each with its own size; the group
+ # keeps one total that only grows, as a model group does.
+ self.runtime_done = max(self.runtime_done, sum(d for d, _ in self.runtime_parts.values()))
+ self.runtime_total = max(self.runtime_total, sum(t for _, t in self.runtime_parts.values()))
self.last = self.tasks[key]
# Completed events need not grow with the number of downloaded files.
for name in list(self.tasks):
@@ -71,12 +83,16 @@ class ProgressState:
active.sort(key=lambda row: (models(row), number(row.get('total')) and row['total'] > 0,
row.get('unit') == 'bytes'), reverse=True)
current = active[0] if active else self._view(self.last, now)
+ if (current.get('name') == RUNTIME_NAME and current.get('activity') == 'download'
+ and self.runtime_total > 0):
+ current = dict(current, unit='bytes', total=self.runtime_total, done=min(self.runtime_done, self.runtime_total),
+ fraction=min(self.runtime_done, self.runtime_total) / self.runtime_total)
if self.download_notices:
notice = next(reversed(self.download_notices.values()))
# A temporary activity line, with the underlying stage and counters
# retained so clearing it restores the current operation immediately.
current = dict(current, label=current.get('label') or notice['label'],
- detail=notice['detail'], activity='', name='')
+ detail=notice['detail'], activity='', name='', notice=True)
return dict(phase_progress=dict(self.phase), active_tasks=active, progress=current, model_groups=self.model_groups)
@staticmethod
@@ -131,7 +147,9 @@ def progress_text(event, zh=False, *, decimal_sizes=False):
# MiB rather than tenths of GiB: even slow disks change the visible text.
parts = [t(verb[0], verb[1] + gap) + name]
done, total = event.get('done'), event.get('total')
- if event.get('unit') == 'bytes' and number(done) and number(total) and total >= 2**20 and done <= total:
+ # Sampling caches are checked file by file; the changing count would only flicker.
+ if (event.get('unit') == 'bytes' and number(done) and number(total) and total >= 2**20 and done <= total
+ and name.lower() not in ('sampling caches', '采样缓存')):
parts.append('%d / %d %s' % (done // 2**20, total // 2**20, 'MiB'))
return ' · '.join(parts)
if activity == 'resume':
@@ -160,6 +178,43 @@ def progress_text(event, zh=False, *, decimal_sizes=False):
return ''
+class LineHold:
+ """A changed line stays three seconds before the latest one replaces it; the lines in between are skipped.
+ Retry, resume, stall and error lines are shown at once and do not start a hold, a language
+ switch drops the held line, and a line that ends stays until a new one replaces it or three
+ seconds pass without one."""
+ HOLD_SECONDS = 3.
+
+ def __init__(self):
+ self.shown = self.shown_at = self.zh = self.blank_since = None
+
+ def text(self, text, now=None, immediate=False, zh=False):
+ now = time.monotonic() if now is None else now
+ if zh != self.zh:
+ self.shown = self.shown_at = None
+ self.zh = zh
+ if immediate:
+ self.shown = self.shown_at = self.blank_since = None
+ return text
+ if not text:
+ # A blank is a change too: the line stays, a new one replaces it at once,
+ # and the blank shows only when no new line came within three seconds.
+ if self.shown is None:
+ return text
+ self.blank_since = now if self.blank_since is None else self.blank_since
+ if now - self.blank_since < self.HOLD_SECONDS or now - self.shown_at < self.HOLD_SECONDS:
+ return self.shown
+ self.shown = self.shown_at = self.blank_since = None
+ return text
+ self.blank_since = None
+ if text == self.shown:
+ return text
+ if self.shown is not None and now - self.shown_at < self.HOLD_SECONDS:
+ return self.shown
+ self.shown, self.shown_at = text, now
+ return text
+
+
class ModelLine:
"""One steady line while a model group downloads: its shards, connections and
checks must not take turns on the screen."""
diff --git a/freevideo_engine/terminal_ui.py b/freevideo_engine/terminal_ui.py
index c764a3a..e344a55 100644
--- a/freevideo_engine/terminal_ui.py
+++ b/freevideo_engine/terminal_ui.py
@@ -329,7 +329,9 @@ class LogProgress:
self.parallel_tasks = {}
self.model_groups = None
# Ninja runs several times during one build, each with its own count.
- self.compile_before, self.compile_last, self.compile_runs = 0, (0, 0), 0
+ self.compile_last, self.compile_runs = (0, 0), 0
+
+ COMPILE_LINE = 'Compile acceleration for your GPU · the first build takes longer'
def compile_fraction(self):
"""How far the compile has advanced, never reaching 1; None before any step.
@@ -441,18 +443,18 @@ class LogProgress:
if package_phase[0] == 'compile':
done, total = int(match[1]), int(match[2])
if total != self.compile_last[1] or done < self.compile_last[0]:
- self.compile_before += self.compile_last[1]
self.compile_runs += self.compile_last[1] > 0
self.compile_last = (done, total)
- shown_done, shown_total = int(match[1]), int(match[2])
if package_phase[0] == 'compile':
- # One count across the runs, so it never restarts from 1.
- shown_done += self.compile_before
- shown_total += self.compile_before
- update(done=shown_done, total=shown_total,
- activity='count', name=package_phase[1],
- detail='Installing packages' if self.installing_packages else 'Compiling CUDA kernels',
- scope='package-' + package_phase[0], unit='items')
+ # The runs have different sizes and their number is unknown, so a count
+ # would grow in jumps; the line keeps the step's own sentence, which says
+ # the wait is expected, and the bar keeps the progress.
+ update(done=0, total=0, activity='note', name=self.COMPILE_LINE,
+ detail='Compiling CUDA kernels', scope='package-compile', unit='items')
+ else:
+ update(done=int(match[1]), total=int(match[2]), activity='count', name=package_phase[1],
+ detail='Installing packages' if self.installing_packages else 'Compiling CUDA kernels',
+ scope='package-' + package_phase[0], unit='items')
try:
event = json.loads(line)
except (ValueError, TypeError):
@@ -612,7 +614,7 @@ class LogProgress:
speed = event.get('network_bytes_per_second')
shown_speed = speed if speed is not None else event['bytes_per_second']
update(done=done, total=total, scope=description + self.model_source, rate=event['bytes_per_second'], unit='bytes',
- activity='download', name=event.get('name') or ('Python' if description.startswith('cpython-') else 'Runtime components' if description == 'torch'
+ activity='download', name=event.get('name') or ('Python' if description.startswith('cpython-') else 'Runtime components' if description == 'torch' or event.get('counter_source') == 'uv-terminal'
else model_download_name(description).split(' · ')[0]),
detail='%s%s%.1f MiB/s · %.1f / %.1f MiB · %s' %
(source + ' · ' if source else '',