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.

Name unreachable model sources and give slow networks a second chance

Bowen Xueefa51e2e1a19
diff --git a/freevideo_engine/failure_details.py b/freevideo_engine/failure_details.py
index 04b742c..5ebbfda 100644
--- a/freevideo_engine/failure_details.py
+++ b/freevideo_engine/failure_details.py
@@ -590,6 +590,10 @@ def launcher_failure(value, *, zh=False, other_disk=False, disk_name='', can_rep
(r'No space left on device|WinError 112|disk (?:is )?full|Not enough disk space|Insufficient disk space', 'disk',
('Not enough disk space', '磁盘空间不足'),
('Free up space on the installation drive, then retry.', '清理安装盘空间后,点击重试。')),
+ (r'Could not reach the pinned prepared model sources', 'model-source',
+ ('The model download sources cannot be reached', '无法连接模型下载源'),
+ ('Check your network or proxy, or change the source or connection mode, then retry.',
+ '请检查网络或代理,或切换下载源、连接模式后重试。')),
(r'Model download paused|unexpected-transfer-size|ConnectionError|ConnectTimeout|ReadTimeout|HTTP probe failed|Could not resolve host|SSL certificate|Every download source failed|All Git sources failed|All package sources failed|Python download failed on every route', 'download',
('Download interrupted', '下载中断了'),
('Check your network or change the source or connection mode in Settings → Downloads, then retry.', '检查网络,或在“设置 → 下载”中切换下载源、连接模式后重试。')),
diff --git a/freevideo_engine/launcher/Main.qml b/freevideo_engine/launcher/Main.qml
index 5095e38..824d96f 100644
--- a/freevideo_engine/launcher/Main.qml
+++ b/freevideo_engine/launcher/Main.qml
@@ -443,7 +443,7 @@ ApplicationWindow {
FButton { objectName: "chooseDisk"; visible: diskFailure && s.form.new_comfy && diskChoices.length > (bestDisk ? 1 : 0); enabled: !s.busy
text: t("Other disks…", "其他硬盘…"); onClicked: diskDialogOpen = true }
FButton { objectName: "diskCleanupButton"; visible: s.failure.kind === "disk"; enabled: s.can_cleanup; text: t("Clean download cache", "清理缓存"); onClicked: { settingsTab = "general"; settingsOpen = true; backend.cleanupDownloads(false) } }
- FButton { visible: s.failure.kind === "download"; text: t("Change source", "切换下载源"); onClicked: { settingsTab = "downloads"; settingsOpen = true } }
+ FButton { objectName: "changeSource"; visible: s.failure.kind === "download" || s.failure.kind === "model-source"; text: t("Change source", "切换下载源"); onClicked: { settingsTab = "downloads"; settingsOpen = true } }
FButton { objectName: "repairCardButton"; primary: true; visible: !!s.repair_offered; text: t("Repair", "修复"); onClicked: backend.action("repair", false) }
FButton { objectName: "latestLauncherLink"; visible: s.failure.kind === "older-launcher"; flat: true
text: t("Download the latest ↗", "下载最新版 ↗"); onClicked: backend.link("https://github.com/FlashML-org/FreeVideo/releases/latest") }
diff --git a/freevideo_engine/prepared_model.py b/freevideo_engine/prepared_model.py
index aaa4b26..1d4d719 100644
--- a/freevideo_engine/prepared_model.py
+++ b/freevideo_engine/prepared_model.py
@@ -9,12 +9,16 @@ import os
from pathlib import Path, PurePosixPath
import re
import subprocess
+import time
from . import execution_paths
from .long_paths import io_path, resolved, plain, plain_errors
from . import network
CATALOG = Path(__file__).with_name('prepared_models.json')
+# (connect, total) seconds per pass; slow-network retries stop once the budget is spent.
+PREFLIGHT_PASSES = ((5, 12), (10, 30))
+PREFLIGHT_SECONDS = 150
@plain_errors
@@ -129,17 +133,31 @@ def access_error(selection, networking, *, environ=None):
'Use --model-source source only if you want the larger original-model conversion.')
manifest = next(r for r in files(selection) if r['file'].endswith('/manifest.json'))
family = network.model_family(manifest)
+ attempts = []
for source, url in network.model_urls(networking, manifest, env):
headers = ['Authorization: Bearer ' + secret] if secret and source == 'official' else []
- for route in network.route_order(networking, family, source, env):
+ attempts += [(source, route, url, headers) for route in network.route_order(networking, family, source, env)]
+ failures = {}
+ started = time.monotonic()
+ # A slow network gets one longer second chance, as the real download does.
+ for connect, total in PREFLIGHT_PASSES:
+ retry = []
+ for source, route, url, headers in attempts:
+ if time.monotonic() - started > PREFLIGHT_SECONDS:
+ break
try:
result = execution_paths.run([
'curl', '--disable', '--silent', '--show-error', '--location', '--head',
- '--output', os.devnull, '--write-out', '%{http_code}', '--connect-timeout', '5',
- '--max-time', '12', '--config', '-'],
- input=network.curl_config(url, headers), capture_output=True, timeout=15,
+ '--output', os.devnull, '--write-out', '%{http_code}', '--connect-timeout', str(connect),
+ '--max-time', str(total), '--config', '-'],
+ input=network.curl_config(url, headers), capture_output=True, timeout=total + 3,
env=network.route_environment(networking, family, source, env, route))
- except (OSError, subprocess.TimeoutExpired):
+ except subprocess.TimeoutExpired:
+ failures[(source, route)] = 'timeout'
+ retry.append((source, route, url, headers))
+ continue
+ except OSError:
+ failures[(source, route)] = 'download tool unavailable'
continue
status = result.stdout.decode('ascii', errors='ignore').strip()
if result.returncode == 0 and status == '200':
@@ -148,10 +166,26 @@ def access_error(selection, networking, *, environ=None):
if selection.get('private') and status in ('401', '403', '404'):
return ('Cannot access the pinned prepared model in ' + selection['repo'] +
'. Check your Hugging Face token and repository access; no large downloads started.')
- return ('Could not reach the pinned prepared model sources. Check the proxy/network and retry; '
+ failures[(source, route)] = preflight_reason(result.returncode, status)
+ if result.returncode == 28:
+ retry.append((source, route, url, headers))
+ attempts = retry
+ if not attempts:
+ break
+ seen = ['%s (%s): %s' % (source, route, reason) for (source, route), reason in failures.items()]
+ return ('Could not reach the pinned prepared model sources' + (' [' + '; '.join(seen) + ']' if seen else '') +
+ '. Check the proxy/network and retry; '
'existing files are retained. No automatic switch to the much larger source model.')
+def preflight_reason(returncode, status):
+ if returncode == 0 and re.fullmatch(r'[1-5]\d\d', status):
+ return 'HTTP ' + status
+ return {6: 'DNS lookup failed', 7: 'connection refused', 28: 'timeout', 35: 'TLS handshake failed',
+ 47: 'too many redirects', 56: 'connection reset', 60: 'certificate not trusted'}.get(
+ returncode, 'download tool exit %d' % returncode)
+
+
def verify_manifest(selection):
from .adaln_assets import file_hash, asset_path
row = next(r for r in files(selection) if r['file'].endswith('/manifest.json'))