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.

A slow download says on the main card that the network is slow and it is trying again

Bowen Xue30bc619ed9f0
diff --git a/freevideo.ps1 b/freevideo.ps1
index f112fbf..5a3e24a 100644
--- a/freevideo.ps1
+++ b/freevideo.ps1
@@ -75,6 +75,7 @@ try {
Write-Host 'Preparing isolated Python for setup. Model/environment installation requires the setup confirmation.'
Write-Host "Bootstrap cache and log: $bootstrapRoot"
$bootstrapLock = [IO.File]::Open((Join-Path $bootstrapRoot 'bootstrap.lock'), 'OpenOrCreate', 'ReadWrite', 'None')
+ $patientDownloadNotice = $false
try {
$versions = Get-Content -LiteralPath (Join-Path $PSScriptRoot 'freevideo_engine\bootstrap_versions.json') -Raw -Encoding UTF8 | ConvertFrom-Json
$uvSpec = $versions.windows.uv
@@ -110,6 +111,10 @@ try {
if ($profile.Mode -eq 'patient') {
if (-not $allNetworkFailures) { break }
Write-Host 'The network is slow. Downloading again; this may take a while.'
+ $patientDownloadNotice = $true
+ if ($env:FREEVIDEO_UI_EVENTS -eq '1') {
+ Write-Host '{"event":"freevideo_ui","kind":"progress","key":"download-patient-python","label":"Download","detail":"The network is slow. Downloading again; this may take a while."}'
+ }
}
foreach ($name in @('UV_HTTP_TIMEOUT', 'UV_HTTP_RETRIES')) {
$value = $freevideoSavedEnvironment[$name]
@@ -139,6 +144,9 @@ try {
$freevideoPython = (& $uv python find --managed-python $versions.python | Select-Object -Last 1).Trim()
if ($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $freevideoPython)) { throw 'Managed Python could not be located.' }
} finally {
+ if ($patientDownloadNotice -and $env:FREEVIDEO_UI_EVENTS -eq '1') {
+ Write-Host '{"event":"freevideo_ui","kind":"progress","key":"download-patient-python","label":"Download","detail":"","state":"complete"}'
+ }
$bootstrapLock.Dispose()
Write-Progress -Activity 'FreeVideo bootstrap' -Completed
}
diff --git a/freevideo_engine/bootstrap.py b/freevideo_engine/bootstrap.py
index cb56322..ba7395c 100644
--- a/freevideo_engine/bootstrap.py
+++ b/freevideo_engine/bootstrap.py
@@ -2,7 +2,7 @@
from __future__ import annotations
import argparse
import csv
-from contextlib import ExitStack
+from contextlib import ExitStack, contextmanager
import hashlib
import json
import os
@@ -1517,10 +1517,28 @@ class Installer:
return network.clone(self.root / 'vendor' / name, url, commit, sparse=sparse, run=self.command,
network=self.network, env=self.env)
+ @contextmanager
+ def download_notice(self, key):
+ """Keep the patient-round notice visible across command heartbeats."""
+ active = False
+
+ def notice(message):
+ nonlocal active
+ self.ui.write(message + '\n')
+ active = True
+ self.ui.event('progress', key=key, label='Download', detail=message)
+
+ try:
+ yield notice
+ finally:
+ if active:
+ self.ui.event('progress', key=key, label='Download', detail='', state='complete')
+
def packages(self, label, args, family='pypi'):
- return network.package_command(self.network, family,
- lambda env, source: self.command(label if source == 'official' else label + '-' + source, args, env=env),
- self.env, notice=lambda message: self.ui.write(message + '\n'))
+ with self.download_notice('download-patient-' + label) as notice:
+ return network.package_command(self.network, family,
+ lambda env, source: self.command(label if source == 'official' else label + '-' + source, args, env=env),
+ self.env, notice=notice)
def python_install(self, uv):
from .system import bootstrap_root
@@ -1555,9 +1573,9 @@ class Installer:
return self.command('python-' + source + '-' + route,
[uv, 'python', 'install', *isolation, self.versions['python']], env=env)
try:
- return network.download_command(self.network, 'github', attempt, self.env, category='python',
- extra_sources=['user-python'] if custom else [],
- notice=lambda message: self.ui.write(message + '\n'))
+ with self.download_notice('download-patient-python') as notice:
+ return network.download_command(self.network, 'github', attempt, self.env, category='python',
+ extra_sources=['user-python'] if custom else [], notice=notice)
except network.PackageSourcesError as error:
failure = RuntimeError('Python download failed on every route; see retained logs')
failure.package_attempts = error.attempts
diff --git a/freevideo_engine/desktop_runtime.py b/freevideo_engine/desktop_runtime.py
index 76815e3..48c082d 100644
--- a/freevideo_engine/desktop_runtime.py
+++ b/freevideo_engine/desktop_runtime.py
@@ -20,6 +20,20 @@ from .long_paths import io_path, resolved, plain, plain_text, plain_errors
from .system import install_root, windows
+def parse_progress_line(line):
+ """Decode the worker's UI protocol; ordinary terminal output stays a log."""
+ if line.startswith('{'):
+ try:
+ message = json.loads(line)
+ if message.get('event') == 'freevideo_ui':
+ return message
+ if message.get('event') == 'local_model_progress':
+ return local_model_ui(message)
+ except (ValueError, AttributeError):
+ pass
+ return None
+
+
def launcher_root():
if os.environ.get('FREEVIDEO_LAUNCHER_HOME'):
return Path(os.environ['FREEVIDEO_LAUNCHER_HOME'])
@@ -334,17 +348,12 @@ class Runner:
log.write(line)
output = (output + line)[-2 * 1024 * 1024:]
self.events.put(('log', line))
- if line.startswith('{'):
- try:
- message = plain_message(json.loads(line))
- if message.get('event') == 'freevideo_ui':
- if message.get('kind') == 'failure' and isinstance(message.get('error'), str):
- error = message['error']
- self.events.put(('progress', message))
- elif message.get('event') == 'local_model_progress':
- self.events.put(('progress', local_model_ui(message)))
- except (ValueError, AttributeError):
- pass
+ message = parse_progress_line(line)
+ if message is not None:
+ message = plain_message(message)
+ if message.get('kind') == 'failure' and isinstance(message.get('error'), str):
+ error = message['error']
+ self.events.put(('progress', message))
code = process.wait(timeout=15)
process.stdout.close()
except BaseException as failure:
diff --git a/freevideo_engine/launcher_copy.py b/freevideo_engine/launcher_copy.py
index 6e8b991..fd1009c 100644
--- a/freevideo_engine/launcher_copy.py
+++ b/freevideo_engine/launcher_copy.py
@@ -13,6 +13,7 @@ SOURCES = {
}
ZH = dict([
+ ('The network is slow. Downloading again; this may take a while.', '网络较慢,正在重试'),
('Prepare Python', '准备 Python'), ('Install Python', '安装 Python'),
('Prepare download tools', '准备下载工具'), ('Tsinghua mirror', '清华镜像'),
('Preparing installation', '准备安装'), ('Checking the environment', '正在检查运行环境'),
diff --git a/freevideo_engine/network.py b/freevideo_engine/network.py
index f72c702..3805852 100644
--- a/freevideo_engine/network.py
+++ b/freevideo_engine/network.py
@@ -586,8 +586,8 @@ _INTEGRITY_FAILURE = re.compile(
r"\b(?:invalid|bad|wrong|incorrect|mismatched?)\s+checksums?\b"
r"|\bchecksums?\s+(?:mismatch|error|failed|failure)\b"
r"|\bchecksums?\s+(?:verification|validation)\s+(?:failed|failure|error)\b"
- r"|\bchecksums?\s+(?:does not|doesn't|did not|didn't|do not|don't)\s+match\b"
- r"|\b(?:does not|doesn't|did not|didn't|do not|don't)\s+match\s+(?:the\s+|its\s+|expected\s+)?(?:checksums?|hash(?:es)?)\b"
+ r"|\bchecksums?\s+(?:does\s+not|doesn't|did\s+not|didn't|do\s+not|don't)\s+match\b"
+ r"|\b(?:does\s+not|doesn't|did\s+not|didn't|do\s+not|don't)\s+match\s+(?:the\s+|its\s+|expected\s+)?(?:checksums?|hash(?:es)?)\b"
r"|\bhash\s+(?:mismatch|check\s+failed|does\s+not\s+match)\b|\bhashes\s+(?:do\s+not|didn't)\s+match\b"
r"|\bsha-?256\s+mismatch\b|\bdigest\s+mismatch\b"
r"|\bintegrity\s+(?:check|verification)\s+failed\b")
diff --git a/freevideo_engine/setup_progress.py b/freevideo_engine/setup_progress.py
index 723fbf7..44dc6d4 100644
--- a/freevideo_engine/setup_progress.py
+++ b/freevideo_engine/setup_progress.py
@@ -16,6 +16,7 @@ class ProgressState:
self.tasks = {}
self.last = {}
self.model_groups = []
+ self.download_notices = {}
def update(self, event, now=None):
now = time.monotonic() if now is None else now
@@ -25,8 +26,15 @@ class ProgressState:
return
if event.get('kind') == 'phase':
self.phase = event
+ self.download_notices.clear()
return
key = str(event.get('key', 'current'))
+ if event.get('kind') == 'progress' and key.startswith('download-patient-'):
+ if event.get('state', 'running') == 'running' and event.get('detail'):
+ self.download_notices[key] = event
+ else:
+ self.download_notices.pop(key, None)
+ return
if event.get('kind') == 'task':
self.tasks.pop(key, None)
previous = self.tasks.get(key, {})
@@ -48,6 +56,12 @@ class ProgressState:
active.sort(key=lambda 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 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='')
return dict(phase_progress=dict(self.phase), active_tasks=active, progress=current, model_groups=self.model_groups)
@staticmethod
diff --git a/freevideo_engine/windows_bootstrap.ps1 b/freevideo_engine/windows_bootstrap.ps1
index b1bcb68..b7cc3e9 100644
--- a/freevideo_engine/windows_bootstrap.ps1
+++ b/freevideo_engine/windows_bootstrap.ps1
@@ -67,9 +67,11 @@ function Invoke-FreeVideoBootstrapCommand {
function Test-FreeVideoSlowDownloadFailure {
param([string]$Detail)
# Keep the patient-round gate aligned with network.slow_download_failure.
+ # URL paths may contain validation words without a validation failure.
+ $Detail = $Detail -replace 'https?://\S+', ''
return ($Detail -match 'timed out|timeout|connection|could not resolve|failed to download|failed to fetch|network is unreachable|ssl|tls|http status|status code|requested url returned error|rpc failed|early eof|unable to access|remote end hung up|couldn''t connect|proxy' -and
$Detail -notmatch '\b(401|403|404|410)\b' -and
- $Detail -notmatch 'no solution found|no matching distribution|could not find a version|checksum|hash mismatch|hashes do not match|hashes didn''t match|hash does not match|hash check failed|sha256 mismatch|sha-256 mismatch|digest mismatch|integrity|certificate verify failed|certificate_verify_failed|invalid peer certificate|unknown issuer|not found|resolutionimpossible|failed to build|invalid wheel|permission denied|no space left on device|disk full')
+ $Detail -notmatch 'no solution found|no matching distribution|could not find a version|\b(?:invalid|bad|wrong|incorrect|mismatched?)\s+checksums?\b|\bchecksums?\s+(?:mismatch|error|failed|failure)\b|\bchecksums?\s+(?:verification|validation)\s+(?:failed|failure|error)\b|\bchecksums?\s+(?:does\s+not|doesn''t|did\s+not|didn''t|do\s+not|don''t)\s+match\b|\b(?:does\s+not|doesn''t|did\s+not|didn''t|do\s+not|don''t)\s+match\s+(?:the\s+|its\s+|expected\s+)?(?:checksums?|hash(?:es)?)\b|\bhash\s+(?:mismatch|check\s+failed|does\s+not\s+match)\b|\bhashes\s+(?:do\s+not|didn''t)\s+match\b|\bsha-?256\s+mismatch\b|\bdigest\s+mismatch\b|\bintegrity\s+(?:check|verification)\s+failed\b|certificate verify failed|certificate_verify_failed|invalid peer certificate|unknown issuer|not found|resolutionimpossible|failed to build|invalid wheel|permission denied|no space left on device|disk full')
}
function Test-FreeVideoUvArchive {