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 one steady line while a model group downloads; torch shows as Runtime components

Bowen Xue0b77acd5e465
diff --git a/freevideo_engine/bootstrap.py b/freevideo_engine/bootstrap.py
index 784f697..e16cc7c 100644
--- a/freevideo_engine/bootstrap.py
+++ b/freevideo_engine/bootstrap.py
@@ -2093,7 +2093,9 @@ INSTALL_PHASE_OTHER_BYTES = 6 * 2**30
# The GPU acceleration build is one task of the phase but takes minutes, so it
# weighs in the same way: as a share of the phase that advances with its counter.
-INSTALL_PHASE_BUILD_BYTES = 3 * 2**30
+# Measured on a fresh Linux install: the compile ran about twice as long as the
+# 21 GiB model download, so it takes a share of the bar on that order.
+INSTALL_PHASE_BUILD_BYTES = 12 * 2**30
def install_phase_units(tasks, finished, download_bytes, fetched_bytes, build_bytes=0, built=0.):
diff --git a/freevideo_engine/launcher_session.py b/freevideo_engine/launcher_session.py
index f33881e..1536217 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 progress_text
+from .setup_progress import ModelLine, progress_text
from .terminal_ui import clean, duration
from .model_upgrade import TARGET
from .runtime_alias import checked_real_path
@@ -2060,6 +2060,11 @@ class Session:
done=min(group['download_bytes'], group.get('downloaded_bytes') or 0),
rate=group.get('bytes_per_second') or progress.get('rate'))
file_text = progress_text(current, zh, decimal_sizes=sys.platform == 'darwin')
+ if not hasattr(self, 'model_line'):
+ self.model_line = ModelLine()
+ steady = self.model_line.line(progress, groups, display('Connecting to download server', zh), zh,
+ sys.platform == 'darwin')
+ file_text = steady if steady is not None else file_text
if self.importer.busy and self.importer.state.get('activity'):
imported = self.importer.state
file_text = progress_text(dict(activity=imported['activity'], unit='bytes',
diff --git a/freevideo_engine/setup_progress.py b/freevideo_engine/setup_progress.py
index 0ef9e5e..a882d20 100644
--- a/freevideo_engine/setup_progress.py
+++ b/freevideo_engine/setup_progress.py
@@ -158,3 +158,61 @@ def progress_text(event, zh=False, *, decimal_sizes=False):
return ' · '.join([t('Downloading ', '正在下载' + gap) + name] +
transfer_parts(event.get('done'), total or 0, event.get('rate'), decimal_sizes))
return ''
+
+
+class ModelLine:
+ """One steady line while a model group downloads: its shards, connections and
+ checks must not take turns on the screen."""
+ STALL_SECONDS, HOLD_SECONDS = 10., 3.
+
+ def __init__(self):
+ self.group = None
+ self.done = self.rate = self.bytes_at = None
+ self.shown = self.shown_at = None
+ self.style = None
+ self.finished = set()
+ self.adopted_at = None
+
+ def line(self, current, groups, connecting, zh=False, decimal_sizes=False, now=None):
+ """The stabilised text, or None when this is not a model download."""
+ now = time.monotonic() if now is None else now
+ name = current.get('name')
+ if (zh, decimal_sizes) != self.style:
+ self.style, self.shown, self.shown_at = (zh, decimal_sizes), None, None
+ if self.group in groups and self.done is not None and self.done >= groups[self.group]['download_bytes']:
+ self.finished.add(self.group)
+ # Groups that download side by side must not take turns: the line stays on one
+ # group until it is complete or has gone quiet, and a finished group is not shown again.
+ since = self.bytes_at if self.bytes_at is not None else self.adopted_at
+ stalled = since is not None and now - since > self.STALL_SECONDS
+ if (current.get('activity') == 'download' and name in groups and name != self.group
+ and name not in self.finished
+ and (self.group is None or self.group in self.finished or stalled)):
+ self.group, self.done, self.rate, self.bytes_at = name, None, None, None
+ self.adopted_at = now
+ self.shown = self.shown_at = None
+ modelish = current.get('activity') in MODEL_ACTIVITIES or current.get('unit') == 'bytes'
+ # A build running beside the download does not take the line while the group is unfinished.
+ if self.group not in groups or not (modelish or self.group not in self.finished):
+ self.group = self.shown = self.shown_at = None
+ return None
+ group = groups[self.group]
+ total = group['download_bytes']
+ done = min(total, group.get('downloaded_bytes') or 0)
+ if self.done is None or done > self.done:
+ self.bytes_at = now if done else self.bytes_at
+ self.done = done
+ if group.get('bytes_per_second'):
+ self.rate = group['bytes_per_second']
+ shown = dict(name=self.group, total=total, done=done, rate=self.rate)
+ if done >= total:
+ text = progress_text(dict(shown, activity='verify'), zh)
+ elif self.bytes_at is None or now - self.bytes_at > self.STALL_SECONDS:
+ text = connecting
+ else:
+ text = progress_text(dict(shown, activity='download', unit='bytes'), zh, decimal_sizes=decimal_sizes)
+ if self.shown is not None and text != self.shown and now - self.shown_at < self.HOLD_SECONDS:
+ return self.shown
+ if text != self.shown:
+ self.shown, self.shown_at = text, now
+ return text
diff --git a/freevideo_engine/terminal_ui.py b/freevideo_engine/terminal_ui.py
index e6ef021..c764a3a 100644
--- a/freevideo_engine/terminal_ui.py
+++ b/freevideo_engine/terminal_ui.py
@@ -612,7 +612,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 'PyTorch' if description == 'torch'
+ activity='download', name=event.get('name') or ('Python' if description.startswith('cpython-') else 'Runtime components' if description == 'torch'
else model_download_name(description).split(' · ')[0]),
detail='%s%s%.1f MiB/s · %.1f / %.1f MiB · %s' %
(source + ' · ' if source else '',
diff --git a/freevideo_engine/torch_download.py b/freevideo_engine/torch_download.py
index 77170c3..5bd5bdd 100644
--- a/freevideo_engine/torch_download.py
+++ b/freevideo_engine/torch_download.py
@@ -39,7 +39,7 @@ def fetch(row, root, family, networking, env, ui, check):
names = list(row['sources'])
candidates = [(name, row['sources'][name]) for name in names if name in row['sources']]
key = 'download-' + row['filename']
- name = 'PyTorch' if row['package'] == 'torch' else row['package']
+ name = 'Runtime components'
source = ''
ui.begin(key, 'Download PyTorch + CUDA', detail=row['filename'])
success = False