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.

Use FreeVideo's own Git when the installed one is too old, name a GPU held back by heat (0.3.11) (#114)

Bowen Xuea016ddfbe45a
diff --git a/freevideo_engine/bootstrap.py b/freevideo_engine/bootstrap.py
index 19d4ac0..a58fc26 100644
--- a/freevideo_engine/bootstrap.py
+++ b/freevideo_engine/bootstrap.py
@@ -205,7 +205,15 @@ def inventory(gpu=None):
'kernel': platform.release(), 'platform': platform.platform(), 'machine': platform.machine(),
'cpu_threads': os.cpu_count(), 'swap_total_bytes': ram.get('swap_total_bytes'),
'swap_free_bytes': ram.get('swap_free_bytes'), 'system_memory': ram,
- 'compiler': shutil.which('cl' if platform.system() == 'Windows' else 'g++'), 'git': shutil.which('git')}
+ 'compiler': shutil.which('cl' if platform.system() == 'Windows' else 'g++'), 'git': usable_git(),
+ 'git_found': shutil.which('git')}
+
+
+def usable_git(path=None, env=None):
+ """The Git on PATH when it is new enough for clone(); None otherwise."""
+ executable = shutil.which('git', path=path)
+ version = network.git_version(executable, env) if executable else None
+ return executable if version and version >= network.MIN_GIT else None
def existing_parent(path):
@@ -499,7 +507,10 @@ def plan(args, *, local_progress=None):
'verification': getattr(args, 'verify', 'auto'),
'build': build,
'kernel_install': 'Pinned Windows Triton / Sage2 wheels; actual kernels checked before readiness' if windows_target else 'Local Sage2 source build / ABI-keyed wheel cache',
- 'git_install': 'Reuse detected Git' if snapshot.get('git') else 'Install verified portable MinGit locally after confirmation' if windows_target else 'Git required',
+ 'git_install': ('Reuse detected Git' if snapshot.get('git') else
+ 'Install verified portable MinGit locally after confirmation' + (
+ ' (the detected Git is older than %d.%d)' % network.MIN_GIT if snapshot.get('git_found') else '')
+ if windows_target else 'Git %d.%d or newer required' % network.MIN_GIT),
'wheel_cache': str(Path(getattr(args, 'wheel_cache', None) or saved.get('wheel_cache') or root / 'wheels').expanduser().resolve()),
'rebuild_sage': getattr(args, 'rebuild_sage', False),
'model_download_bytes': sum(r['bytes'] for r in files) - present - (local_reuse or {}).get('reused_bytes', 0),
@@ -1339,7 +1350,8 @@ class Installer:
return manifest
def install_git_windows(self):
- if shutil.which('git', path=self.env['PATH']):
+ # An older Git on PATH cannot fetch the pinned sources; use the portable one.
+ if usable_git(self.env['PATH'], self.env):
return
spec = self.versions['windows']['git']
archive = self.root / 'downloads' / ('MinGit-' + spec['version'] + '.zip')
diff --git a/freevideo_engine/comfy_assets.py b/freevideo_engine/comfy_assets.py
index 3f3d1be..a6e230b 100644
--- a/freevideo_engine/comfy_assets.py
+++ b/freevideo_engine/comfy_assets.py
@@ -3,6 +3,7 @@ import json
import logging
import math
from pathlib import Path, PurePosixPath, PureWindowsPath
+from .monitoring import thermal_slowdown
def saved_video(output, output_directory):
@@ -153,6 +154,7 @@ def output_summary(report, relative_video):
geometry=report.get('geometry', {}),
sampling_plan=report.get('sampling_plan'),
low_memory=bool(report.get('low_memory_mode')),
+ thermal=thermal_slowdown(((report.get('memory') or {}).get('video') or {}).get('gpu')),
reference_trims=report.get('encoding', {}).get('reference_trims') or [],
preview=bool(report.get('preview')), upscaled_preview=bool(report.get('upscaled_preview')),
video=relative_video.as_posix(), report=relative_video.with_suffix(
diff --git a/freevideo_engine/failure_details.py b/freevideo_engine/failure_details.py
index 7b7c2c5..751d113 100644
--- a/freevideo_engine/failure_details.py
+++ b/freevideo_engine/failure_details.py
@@ -98,6 +98,10 @@ def launcher_failure(value, *, zh=False):
action='展开详情或导出报告,查看完整检查结果。' if zh else
'Open the details or export the report for the complete results.', kind='kernels')
rules = (
+ (r'Git \d+\.\d+ is too old to download the pinned sources', 'git-version',
+ ('Git is too old', 'Git 版本过旧'),
+ ('Click Retry installation; on Windows FreeVideo then uses its own Git. On Linux or macOS, update Git to 2.35 or newer.',
+ '请点击“重试安装”,Windows 上 FreeVideo 会改用自带的 Git;Linux 或 macOS 请把 Git 更新到 2.35 或更高版本。')),
# web/health.js lists the failed files and what to do on the page itself.
(r'The browser page did not load FreeVideo completely|浏览器页面没有完整加载 FreeVideo', 'page',
('FreeVideo did not load completely in the browser', '浏览器里的 FreeVideo 没有完整加载'),
diff --git a/freevideo_engine/monitoring.py b/freevideo_engine/monitoring.py
index 5b2b31f..4abf920 100644
--- a/freevideo_engine/monitoring.py
+++ b/freevideo_engine/monitoring.py
@@ -78,6 +78,30 @@ class Activity:
return result
+def thermal_slowdown(measured, *, share=.5, clock_ratio=.7, minimum_samples=200):
+ """The worker's busy time held back by driver thermal slowdown, or None.
+
+ Counted only when thermal reasons cover at least `share` of the busy
+ samples and the mean SM clock stays below `clock_ratio` of the highest
+ one observed, so a brief hot spell or a normal power cap is not reported.
+ """
+ busy = measured.get('busy_activity') if isinstance(measured, dict) else None
+ if not isinstance(busy, dict):
+ return None
+ samples = busy.get('clock_reason_samples') or 0
+ counts = busy.get('clock_reason_counts') or {}
+ clock = busy.get('sm_clock_mhz') or {}
+ mean, peak = clock.get('mean'), clock.get('maximum')
+ if samples < minimum_samples or not mean or not peak:
+ return None
+ thermal = min(samples, max(counts.get('sw_thermal') or 0, counts.get('hw_thermal') or 0))
+ if thermal < share * samples or mean > clock_ratio * peak:
+ return None
+ temperature = (busy.get('temperature_c') or {}).get('mean')
+ return dict(share=round(thermal / samples, 3), sm_clock_mean_mhz=round(mean), sm_clock_max_mhz=round(peak),
+ temperature_mean_c=round(temperature, 1) if isinstance(temperature, (int, float)) else None)
+
+
class Monitor:
def __init__(self, path, interval=0.05, device=None):
if windows():
diff --git a/freevideo_engine/network.py b/freevideo_engine/network.py
index 767877b..4c4f00b 100644
--- a/freevideo_engine/network.py
+++ b/freevideo_engine/network.py
@@ -873,6 +873,29 @@ def download(candidates, path, expected, progress=None, *, network=None, env=Non
raise DownloadError('Every download source failed for %s. Check your network or choose another connection mode in Downloads. Partial files retained' % path.name)
+# clone() passes the remote through GIT_CONFIG_* (Git 2.31) and narrows
+# references with `sparse-checkout set --no-cone` (Git 2.35). Older Git fails
+# with "'origin' does not appear to be a git repository".
+MIN_GIT = (2, 35)
+
+
+def git_version(executable, env=None):
+ """(major, minor) of a Git executable, or None when it cannot be run or read."""
+ try:
+ output = subprocess.run([str(executable), '--version'], env=env, stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT, text=True, timeout=30, **hidden_console()).stdout
+ except (OSError, ValueError, subprocess.SubprocessError):
+ return None
+ found = re.search(r'git version (\d+)\.(\d+)', output or '')
+ return (int(found[1]), int(found[2])) if found else None
+
+
+def old_git_message(version):
+ return ('Git %d.%d is too old to download the pinned sources; FreeVideo needs Git %d.%d or newer. '
+ 'On Windows, click Retry installation to use FreeVideo\'s own Git; elsewhere, update Git.'
+ % (*version, *MIN_GIT))
+
+
def clone(target, url, commit, *, sparse=None, run=None, network=None, env=None):
"""Fetch only the pinned commit, atomically; never reset existing checkouts."""
target = Path(target)
@@ -880,6 +903,9 @@ def clone(target, url, commit, *, sparse=None, run=None, network=None, env=None)
env = proxy_environment(env)
env.update(GIT_TERMINAL_PROMPT='0', GIT_HTTP_LOW_SPEED_LIMIT='1024', GIT_HTTP_LOW_SPEED_TIME='20')
git = env.get('FREEVIDEO_GIT') or 'git'
+ version = git_version(git, env) if not target.exists() else None
+ if version and version < MIN_GIT:
+ raise RuntimeError(old_git_message(version))
def execute(label, command):
command = [git, *command[1:]]
if run:
diff --git a/freevideo_engine/release_notes.json b/freevideo_engine/release_notes.json
index 2240169..7e8d44e 100644
--- a/freevideo_engine/release_notes.json
+++ b/freevideo_engine/release_notes.json
@@ -2,19 +2,23 @@
"schema": 1,
"product_version": "0.3.11",
"en": {
- "summary": "Importing offline packages is faster and shows its progress throughout.",
+ "summary": "Importing offline packages is faster and shows its progress throughout, setup works with an older Git, and a GPU slowed down by heat is named on the result.",
"changes": [
"Offline packages are checked once, while they are unpacked. Importing a package again, Checking packages before installing and the first start no longer read every file again.",
"The Working card shows which package is being imported and how far it is; Checking packages and Verify local files show their progress as well.",
- "After the Environment package is imported, the model step no longer asks for it again."
+ "After the Environment package is imported, the model step no longer asks for it again.",
+ "On Windows, when the Git already installed is older than 2.35, setup uses FreeVideo's own verified Git instead of stopping with \"'origin' does not appear to be a git repository\". On Linux and macOS, setup names the Git version and asks for 2.35 or newer.",
+ "When the GPU spends most of a generation in thermal slowdown, the result says so, with the temperature and how far the clock dropped, and diagnostic reports include it."
]
},
"zh": {
- "summary": "离线包导入更快,全程都能看到进度。",
+ "summary": "离线包导入更快,全程都能看到进度;装有旧版 Git 的电脑可以正常安装;显卡因过热降频变慢时,结果下方会说明。",
"changes": [
"离线包只在解压时校验一次;再次导入同一个包、安装前「检查配套包」和首次启动都不再把所有文件重读一遍。",
"左侧「正在处理」卡片会显示正在导入第几个包和进度;「检查配套包」和「校验本地文件」也有进度条。",
- "导入运行环境包后,模型这一步不再提示还需要运行环境包。"
+ "导入运行环境包后,模型这一步不再提示还需要运行环境包。",
+ "Windows 上如果已安装的 Git 低于 2.35,安装时会改用 FreeVideo 自带并校验过的 Git,不再因“'origin' does not appear to be a git repository”中断;Linux 和 macOS 会写明 Git 版本,并提示更新到 2.35 或更高版本。",
+ "显卡在生成过程中大部分时间因过热降频时,结果下方会说明温度和降频幅度,诊断报告中也会包含。"
]
}
}
diff --git a/freevideo_engine/support_report.py b/freevideo_engine/support_report.py
index f48696e..2ca4e40 100644
--- a/freevideo_engine/support_report.py
+++ b/freevideo_engine/support_report.py
@@ -8,6 +8,7 @@ import sys
import time
from . import __version__
+from .monitoring import thermal_slowdown
from .diagnostics import Redactor, is_link, read_bounded
from .diagnostic_resources import kernel_receipt
from .monitoring import save
@@ -129,6 +130,14 @@ def summarize(report, engine, encoding):
hints.append(dict(kind='measured', message='This process exceeded its Windows local video-memory budget during sampling. '
'Compare the per-step nonlocal memory and latency; this is pressure evidence, not a measured PCIe paging rate.',
message_zh='采样时进程超过了 Windows 分配的本地显存预算。请对照每步共享内存与耗时;这是压力证据,不是 PCIe 换页速率测量。'))
+ thermal = thermal_slowdown(mapping(mapping(report.get('memory')).get('video')).get('gpu'))
+ if thermal:
+ hints.append(dict(kind='measured', message='The GPU was in thermal slowdown for %d%% of its busy time: %d of %d MHz on '
+ 'average%s. Cooling limited this request, not the plan.' % (round(100 * thermal['share']), thermal['sm_clock_mean_mhz'],
+ thermal['sm_clock_max_mhz'], ' at %.0f °C' % thermal['temperature_mean_c'] if thermal['temperature_mean_c'] else ''),
+ message_zh='显卡在 %d%% 的计算时间里处于温控降频,平均 %d/%d MHz%s。这次用时受散热限制,不是规划问题。' % (
+ round(100 * thermal['share']), thermal['sm_clock_mean_mhz'], thermal['sm_clock_max_mhz'],
+ ',%.0f °C' % thermal['temperature_mean_c'] if thermal['temperature_mean_c'] else '')))
attempts = report.get('resource_attempts', [])
failures = [dict(state=r.get('state'), failure=r.get('failure')) for r in attempts
if isinstance(r, dict) and r.get('failure')] if isinstance(attempts, list) else []
diff --git a/scripts/test_freevideo_entry.mjs b/scripts/test_freevideo_entry.mjs
index 410c0ad..bd738e6 100644
--- a/scripts/test_freevideo_entry.mjs
+++ b/scripts/test_freevideo_entry.mjs
@@ -36,6 +36,7 @@ test('main browser entry registers both views and preserves node hooks', async (
loraPanel: () => () => {}, loraWarning: () => 'LoRA warning', promptGuide: () => new Element('guide'),
createGenerationProgress: () => ({element: new Element('progress'), report: new Element('report'), updateReport() {}, update() {}, hide() {}, dispose() {}, noticeCount: () => 0}),
referenceTrimText: row => `trimmed ${row.kind} ${row.number}`,
+ thermalText: thermal => `thermal ${thermal.sm_clock_mean_mhz}`,
createProgressConnection: () => ({start() {}, refresh() {}, reset() {}}),
notifyCompatibility: async () => { compatibilityChecks++; },
startUpdateChecks: () => { updateChecks++; },
@@ -61,7 +62,7 @@ test('main browser entry registers both views and preserves node hooks', async (
.replace('import { app } from "../../scripts/app.js";', 'const {app} = globalThis.__freevideoEntryTest;')
.replace('import { api } from "../../scripts/api.js";', 'const {api} = globalThis.__freevideoEntryTest;')
.replace("import { openStudio, loraPanel, loraWarning, promptGuide } from \"./studio.js\";", 'const {openStudio,loraPanel,loraWarning,promptGuide} = globalThis.__freevideoEntryTest;')
- .replace("import { createGenerationProgress, referenceTrimText } from './generation_progress.js';", 'const {createGenerationProgress,referenceTrimText} = globalThis.__freevideoEntryTest;')
+ .replace("import { createGenerationProgress, referenceTrimText, thermalText } from './generation_progress.js';", 'const {createGenerationProgress,referenceTrimText,thermalText} = globalThis.__freevideoEntryTest;')
.replace("import { createProgressConnection } from './progress_connection.js';", 'const {createProgressConnection} = globalThis.__freevideoEntryTest;')
.replace("import { notifyCompatibility } from './compatibility.js';", 'const {notifyCompatibility} = globalThis.__freevideoEntryTest;')
.replace("import { startUpdateChecks } from './updates.js';", 'const {startUpdateChecks} = globalThis.__freevideoEntryTest;')
diff --git a/web/freevideo.js b/web/freevideo.js
index 8fe5e2c..cfbe04a 100644
--- a/web/freevideo.js
+++ b/web/freevideo.js
@@ -2,7 +2,7 @@ import { createErrorPanel, errorText } from './error_panel.js';
import { app } from "../../scripts/app.js";
import { api } from "../../scripts/api.js";
import { openStudio, loraPanel, loraWarning, promptGuide } from "./studio.js";
-import { createGenerationProgress, referenceTrimText } from './generation_progress.js';
+import { createGenerationProgress, referenceTrimText, thermalText } from './generation_progress.js';
import { createProgressConnection } from './progress_connection.js';
import { notifyCompatibility } from './compatibility.js';
import { startUpdateChecks } from './updates.js';
@@ -336,6 +336,7 @@ function resultPanel(node) {
panel.append(stats, links, progress.report);
for (const row of value.reference_trims || []) panel.append(el("div", referenceTrimText(row, text), "fv-note fv-trim-note"));
if (value.low_memory && !value.result_cache_hit) panel.append(el("div", text('This video used the low-memory mode for this GPU, so it took longer than usual. A lower resolution or a shorter video runs faster.', '这段视频使用了省显存方式,所以比平时慢。降低分辨率或缩短时长会更快。'), "fv-note"));
+ if (value.thermal && !value.result_cache_hit) panel.append(el("div", thermalText(value.thermal, text), "fv-note"));
warn();
panel.title = (unified
? text("Unified memory: device capacity. Process RAM is not total GPU memory, ", "统一内存为设备总量;进程内存不代表 GPU 内存总占用,")
diff --git a/web/generation_progress.js b/web/generation_progress.js
index 881bf8a..e75d717 100644
--- a/web/generation_progress.js
+++ b/web/generation_progress.js
@@ -59,6 +59,15 @@ function planText(message, t) {
// A reference clip longer than the video being generated is cut to the same
// length, at most 15 s, as in the official pipeline. Say so; never cut silently.
+// The driver held the clock down for heat for most of the run (summary.thermal).
+export function thermalText(thermal, t) {
+ const share = thermal.sm_clock_max_mhz ? Math.round(100 * thermal.sm_clock_mean_mhz / thermal.sm_clock_max_mhz) : null;
+ const heat = Number.isFinite(thermal.temperature_mean_c) ? Math.round(thermal.temperature_mean_c) : null;
+ const detail = [heat !== null ? `${heat} °C` : '', share !== null ? t(`${share}% of its peak clock`, `频率只有峰值的 ${share}%`) : ''].filter(Boolean).join(t(', ', ','));
+ return t(`The GPU spent most of this video in thermal slowdown${detail ? ` (${detail})` : ''}, so it took much longer than usual. Improve cooling; on a laptop, plug in and choose a high-performance power mode.`,
+ `生成这段视频时,显卡大部分时间因过热降频${detail ? `(${detail})` : ''},所以比平时慢很多。请改善散热;笔记本请接通电源并选择高性能模式。`);
+}
+
export function referenceTrimText(row, t) {
const kind = row?.kind === 'audio' ? t('Reference audio', '参考音频') : t('Reference video', '参考视频');
const name = Number.isInteger(row?.number) ? `${kind} ${row.number}` : kind;
diff --git a/web/studio.js b/web/studio.js
index 06d5cb8..ee761be 100644
--- a/web/studio.js
+++ b/web/studio.js
@@ -3,7 +3,7 @@ import { app } from '../../scripts/app.js';
import { api } from '../../scripts/api.js';
import { openSetup } from './setup.js';
import { wordmark } from './branding.js';
-import { createGenerationProgress, referenceTrimText } from './generation_progress.js';
+import { createGenerationProgress, referenceTrimText, thermalText } from './generation_progress.js';
import { viewSwitch, viewChanged } from './view_navigation.js';
import { createUpdateNotice, createVersionInfo, productVersion } from './updates.js';
import { reportIssue, reportTipClosed, showReportTip } from './report_issue.js';
@@ -506,7 +506,8 @@ export function openStudio(node) {
catch (error) { status.dataset.error = 'true'; status.textContent = error.message; throw error; }
};
const memoryNote = el('div', t('This video used the low-memory mode for this GPU, so it took longer than usual. A lower resolution or a shorter video runs faster.', '这段视频使用了省显存方式,所以比平时慢。降低分辨率或缩短时长会更快。'), 'fv-note'); memoryNote.hidden = true;
- output.append(status, reuseRow, trimNote, memoryNote, links, stats, budget, progress.report, prewarm);
+ const thermalNote = el('div', '', 'fv-note'); thermalNote.hidden = true;
+ output.append(status, reuseRow, trimNote, memoryNote, thermalNote, links, stats, budget, progress.report, prewarm);
const failure = createErrorPanel(t); output.append(failure.element);
// With the picture, the result's actions and numbers form one block, centred below the header.
output.append(el('div', null, 'fv-preview-end'));
@@ -529,6 +530,7 @@ export function openStudio(node) {
const trims = Array.isArray(r.reference_trims) ? r.reference_trims : [];
trimNote.textContent = trims.map(row => referenceTrimText(row, t)).join('\n'); trimNote.hidden = !trims.length;
memoryNote.hidden = !r.low_memory || !!r.result_cache_hit;
+ thermalNote.textContent = r.thermal ? thermalText(r.thermal, t) : ''; thermalNote.hidden = !r.thermal || !!r.result_cache_hit;
regenerate.disabled = false; regenerate.textContent = t('Regenerate', '重新生成');
const unified = r.memory_model === 'unified';
metricLabels[2].textContent = unified ? t('Unified memory', '统一内存总量') : t('VRAM peak', '显存峰值');