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 short note under the result says when other programs used a large part of the GPU
Bowen Xueb7f3713fdf3e
diff --git a/freevideo_engine/comfy_assets.py b/freevideo_engine/comfy_assets.pyindex 51d13de..88d142e 100644--- a/freevideo_engine/comfy_assets.py+++ b/freevideo_engine/comfy_assets.py@@ -4,7 +4,7 @@ import mathimport osfrom pathlib import Path, PurePosixPath, PureWindowsPathfrom . import launcher_bridge-from .monitoring import thermal_slowdown+from .monitoring import thermal_slowdown, shared_gpu_note, worker_gpufrom .paths import data_rootfrom .support_report import encoder_sizes@@ -155,7 +155,8 @@ def output_summary(report, relative_video):geometry=dict(report.get('geometry', {}), **(report.get('output_size') or {})),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')),+ thermal=thermal_slowdown(worker_gpu(report)),+ shared_gpu=shared_gpu_note(worker_gpu(report)),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/monitoring.py b/freevideo_engine/monitoring.pyindex b3d92c0..2b4ce75 100644--- a/freevideo_engine/monitoring.py+++ b/freevideo_engine/monitoring.py@@ -93,18 +93,21 @@ def thermal_slowdown(measured, *, share=.5, clock_ratio=.7, minimum_samples=200)busy = measured.get('busy_activity') if isinstance(measured, dict) else Noneif 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')+ samples = _count(busy.get('clock_reason_samples'))+ counts = busy.get('clock_reason_counts')+ counts = counts if isinstance(counts, dict) else {}+ clock = busy.get('sm_clock_mhz')+ clock = clock if isinstance(clock, dict) else {}+ mean, peak = _count(clock.get('mean')), _count(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))+ thermal = min(samples, max(_count(counts.get('sw_thermal')), _count(counts.get('hw_thermal'))))if thermal < share * samples or mean > clock_ratio * peak:return None- temperature = (busy.get('temperature_c') or {}).get('mean')+ temperature = busy.get('temperature_c')+ temperature = temperature.get('mean') if isinstance(temperature, dict) else Nonereturn 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)+ temperature_mean_c=round(temperature, 1) if type(temperature) in (int, float) and 0 <= temperature <= 1000 else None)class OtherPrograms:@@ -231,14 +234,33 @@ def shared_gpu(measured, *, share=.5, minimum_checks=30):if not isinstance(programs, dict):return Nonechecks, shared, mean = (programs.get(key) for key in ('checks', 'shared_checks', 'other_mean_percent'))- if (any(type(value) not in (int, float) or not value >= 0 for value in (checks, shared, mean))- or checks < minimum_checks or shared < share * checks):+ if (any(type(value) not in (int, float) for value in (checks, shared, mean))+ or not minimum_checks <= checks <= 1e9 or not 0 <= shared <= checks or not 0 <= mean <= 100+ or shared < share * checks):return Nonereturn dict(share=round(shared / checks, 3), other_mean_percent=round(mean))+# Other programs' mean share of the GPU, in percent, from which the result says so:+# the run took at least about a quarter longer than with the GPU to itself.+SHARED_NOTE_PERCENT = 20+++def shared_gpu_note(measured):+ """{other_mean_percent} for the note under a result, or None.++ Shown when other programs averaged at least SHARED_NOTE_PERCENT of the+ GPU, and shared_gpu holds: at least 30 checks, with other programs using+ at least 20% in at least half of them.+ """+ if shared_gpu(measured) is None:+ return None+ mean = measured['other_programs']['other_mean_percent']+ return dict(other_mean_percent=mean) if mean >= SHARED_NOTE_PERCENT else None++def _count(value):- return value if type(value) in (int, float) and 0 <= value < float('inf') else 0+ return value if type(value) in (int, float) and 0 <= value <= 1e12 else 0def combined(rows):diff --git a/scripts/test_freevideo_entry.mjs b/scripts/test_freevideo_entry.mjsindex 0b86732..d386fb3 100644--- a/scripts/test_freevideo_entry.mjs+++ b/scripts/test_freevideo_entry.mjs@@ -53,6 +53,7 @@ test('main browser entry registers both views and preserves node hooks', async t},referenceTrimText: row => `trimmed ${row.kind} ${row.number}`,thermalText: thermal => `thermal ${thermal.sm_clock_mean_mhz}`,+ sharedGpuText: shared => `shared GPU ${shared.other_mean_percent}%`,encoderFileText: file => `encoder ${file.sizes.join(' / ')} GiB`,encoderFilePath: file => file?.offline_installation ? file.path || '' : '',createProgressConnection: () => ({start() {}, refresh() {}, reset() {}}),@@ -82,7 +83,7 @@ test('main browser entry registers both views and preserves node hooks', async t.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, thermalText, encoderFileText, encoderFilePath } from './generation_progress.js';", 'const {createGenerationProgress,referenceTrimText,thermalText,encoderFileText,encoderFilePath} = globalThis.__freevideoEntryTest;')+ .replace("import { createGenerationProgress, referenceTrimText, thermalText, sharedGpuText, encoderFileText, encoderFilePath } from './generation_progress.js';", 'const {createGenerationProgress,referenceTrimText,thermalText,sharedGpuText,encoderFileText,encoderFilePath} = 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;')@@ -191,12 +192,14 @@ test('main browser entry registers both views and preserves node hooks', async tlauncher: true, offline_installation: false};const resultWidth = node.size[0];node.setSize([resultWidth, 100]);- node.freevideoShowResult({freevideo_summary: [{video, result_cache_hit: true, sample_seconds: 99, encoder_file}]});+ node.freevideoShowResult({freevideo_summary: [{video, result_cache_hit: true, sample_seconds: 99, encoder_file,+ thermal: {sm_clock_mean_mhz: 900}, shared_gpu: {other_mean_percent: 42}}]});const reused = node.dom.find(row => row.name === 'freevideo_result').element;assert.equal(reused.children[0].hidden, true, 'Do not show the old sampling time as current work');assert.ok(reused.children[1].children.some(e => e.textContent === 'Reused previous result'));assert.ok(reused.children.some(e => e.className === 'fv-note' && e.textContent === 'encoder 25.3 / 14.6 GiB'),'A cached result still came from the same encoder file');+ assert.ok(!reused.children.some(e => e.textContent === 'shared GPU 42%'), 'A cached result did not share the GPU this time');assert.deepEqual(node.size, [resultWidth, node.computeSize()[1]], 'Grow the node after appending the encoder notice');const again = reused.children[1].children.at(-1);assert.equal(again.textContent, 'Regenerate');@@ -218,11 +221,12 @@ test('main browser entry registers both views and preserves node hooks', async tassert.ok(node.computeSize()[1] < progressHeight);assert.deepEqual(node.size, [resultWidth, progressHeight], 'Shorter results must not shrink the node');node.freevideoShowResult({freevideo_summary: [{video, sample_seconds: 5, encoder_file, thermal: {sm_clock_mean_mhz: 900},+ shared_gpu: {other_mean_percent: 42},reference_trims: [{kind: 'video', number: 1, seconds: 20.3, used_seconds: 5.17}]}]});assert.deepEqual(reused.children.filter(e => e.className === 'fv-note fv-trim-note').map(e => e.textContent),['trimmed video 1'], 'Say which reference was shortened, never cut silently');assert.deepEqual(reused.children.filter(e => e.className === 'fv-note' && !e.hidden).map(e => e.textContent),- ['thermal 900', 'encoder 25.3 / 14.6 GiB'], 'Show the encoder notice after the thermal notice');+ ['thermal 900', 'shared GPU 42%', 'encoder 25.3 / 14.6 GiB'], 'Show thermal, shared GPU and encoder notices in order');assert.ok(node.computeSize()[1] > progressHeight);assert.deepEqual(node.size, [resultWidth, node.computeSize()[1]], 'Measure the result height after all notices are appended');@@ -265,8 +269,9 @@ test('main browser entry registers both views and preserves node hooks', async tnode.freevideoShowFailure({exception_message: 'Failed'});assert.equal(options.getMinHeight(), 420, 'Failure keeps its existing height');node.freevideoShowResult({freevideo_summary: [{video, low_memory: true, thermal: {sm_clock_mean_mhz: 900},+ shared_gpu: {other_mean_percent: 42},reference_trims: [{kind: 'video', number: 1}]}]});- assert.equal(options.getMinHeight(), 461, 'Measure memory, thermal and reference trim notices');+ assert.equal(options.getMinHeight(), 543, 'Add 82 px for the shared GPU notice: 66 px text height and two 8 px margins');});class MediaNode extends GenerateNode {diff --git a/web/freevideo.js b/web/freevideo.jsindex 8a96260..7678efe 100644--- a/web/freevideo.js+++ b/web/freevideo.js@@ -3,7 +3,7 @@ import { app } from "../../scripts/app.js";import { api } from "../../scripts/api.js";import { openEditorView } from './editor_loader.js';import { openStudio, loraPanel, loraWarning, promptGuide } from "./studio.js";-import { createGenerationProgress, referenceTrimText, thermalText, encoderFileText, encoderFilePath } from './generation_progress.js';+import { createGenerationProgress, referenceTrimText, thermalText, sharedGpuText, encoderFileText, encoderFilePath } from './generation_progress.js';import { createProgressConnection } from './progress_connection.js';import { notifyCompatibility } from './compatibility.js';import { startUpdateChecks } from './updates.js';@@ -26,7 +26,7 @@ const style = document.createElement("style");style.textContent = `.fv-panel{box-sizing:border-box;width:100%;height:100%;padding:16px;background:var(--fv-card);color:var(--fv-ink);border:1px solid var(--fv-border);border-radius:var(--fv-r-md,12px);font:13px/1.6 var(--fv-font);overflow:auto;color-scheme:dark}.fv-panel *{box-sizing:border-box}.fv-toolbar,.fv-row,.fv-links{display:flex;align-items:center;gap:8px;flex-wrap:wrap}-.fv-panel .fv-links{justify-content:center}.fv-panel[data-freevideo=result]>.fv-note{text-align:center}+.fv-panel .fv-links{justify-content:center}.fv-panel[data-freevideo=result]>.fv-note{text-align:center;text-wrap:balance}.fv-panel .fv-toolbar{padding:4px 0 8px}.fv-panel .fv-stats{text-align:center}.fv-panel .fv-stat{padding:10px 3px;border-radius:var(--fv-r-md,12px);background:var(--fv-raised)}.fv-panel .fv-stats[hidden]{display:none}.fv-panel .fv-connected{display:flex;align-items:center;justify-content:center;gap:6px;flex-wrap:wrap;margin:10px 0}.fv-panel .fv-connection{border:1px solid var(--fv-border);border-radius:var(--fv-r-sm,8px);padding:5px 9px;background:var(--fv-selected);color:var(--fv-accent);font-size:var(--fv-micro,12px)}@@ -504,6 +504,8 @@ function resultPanel(node) {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) resultNotes.push(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) resultNotes.push(el("div", thermalText(value.thermal, text), "fv-note"));+ const shared = value.shared_gpu && !value.result_cache_hit ? sharedGpuText(value.shared_gpu, text) : '';+ if (shared) resultNotes.push(el("div", shared, "fv-note"));if (value.encoder_file) {const note = el("div", encoderFileText(value.encoder_file, text), "fv-note");const path = encoderFilePath(value.encoder_file);diff --git a/web/generation_progress.js b/web/generation_progress.jsindex bb281d4..6c32e8a 100644--- a/web/generation_progress.js+++ b/web/generation_progress.js@@ -177,11 +177,21 @@ function trimStatus(rows, t) {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(', ', ','));+ const detail = [heat !== null ? `${heat}\u00a0°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})` : ''},所以比平时慢很多。请改善散热;笔记本请接通电源并选择高性能模式。`);}+// Other programs held a substantial share of the GPU during this run (summary.shared_gpu).+// The share is rounded to 5% and written as at most 95%; without a usable number there is no note.+export function sharedGpuText(shared, t) {+ const mean = shared?.other_mean_percent;+ if (typeof mean !== 'number' || !Number.isFinite(mean)) return '';+ const percent = Math.min(95, Math.round(mean / 5) * 5);+ return t(`Other programs were using about ${percent}% of the GPU.`,+ `其他程序占用了约 ${percent}% 的显卡。`);+}+export function encoderFilePath(file) {return file?.offline_installation === true && typeof file.path === 'string' ? file.path : '';}diff --git a/web/studio.css b/web/studio.cssindex 86cf8b2..b20eb02 100644--- a/web/studio.css+++ b/web/studio.css@@ -119,6 +119,8 @@.fv-studio .fv-progress{width:100%;height:4px;accent-color:var(--fv-accent);border:0;margin:0 0 10px}.fv-studio .fv-budget,.fv-studio .fv-prewarm{text-align:center;font-size:var(--fv-micro);color:var(--fv-muted)}.fv-studio .fv-panel{height:auto;padding:0;border:none;border-radius:0;background:transparent;color:var(--fv-ink);font-size:var(--fv-micro);overflow:visible}.fv-studio .fv-panel .fv-toolbar{justify-content:flex-start}.fv-studio .fv-panel .fv-note{font-size:var(--fv-micro);margin:8px 0;text-align:left}+.fv-studio .fv-preview-column>.fv-note{text-align:center;text-wrap:balance}+.fv-studio .fv-preview-column>.fv-note:not([hidden])+.fv-note{margin-top:calc(0px - 19px)}.fv-studio .fv-panel .fv-empty{display:grid;place-items:center;padding:22px 15px;min-height:92px;margin-top:12px;font-size:var(--fv-micro);white-space:pre-line;border-color:var(--fv-border);background:var(--fv-card)}.fv-studio .fv-panel .fv-preview{max-height:170px;margin:10px auto;object-fit:contain}.fv-studio .fv-panel .fv-card{background:var(--fv-card);border-color:var(--fv-border)}.fv-studio .fv-panel select{min-height:var(--fv-h-sm);padding:5px 8px;max-width:145px;width:auto}.fv-studio .fv-panel button{font-size:var(--fv-micro);padding:5px 10px;min-height:var(--fv-h-sm)}diff --git a/web/studio.js b/web/studio.jsindex a273126..b779a97 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 './wordmark.js';-import { createGenerationProgress, referenceTrimText, thermalText, encoderFileText, encoderFilePath } from './generation_progress.js';+import { createGenerationProgress, referenceTrimText, thermalText, sharedGpuText, encoderFileText, encoderFilePath } from './generation_progress.js';import { viewSwitch, viewChanged, agentTabReady, openAutopilot } from './view_navigation.js';import { agentInterfaceEnabled } from './agent_connect.js';import { createUpdateNotice, createVersionInfo, productVersion } from './updates.js';@@ -647,8 +647,9 @@ export function openStudio(node, {extendFrom = null} = {}) {};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;const thermalNote = el('div', '', 'fv-note'); thermalNote.hidden = true;+ const sharedGpuNote = el('div', '', 'fv-note'); sharedGpuNote.hidden = true;const encoderNote = el('div', '', 'fv-note'); encoderNote.hidden = true;- output.append(status, reuseRow, trimNote, memoryNote, thermalNote, encoderNote, links, stats, budget, progress.stall, progress.report, prewarm);+ output.append(status, reuseRow, trimNote, memoryNote, thermalNote, sharedGpuNote, encoderNote, links, stats, budget, progress.stall, 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'));@@ -680,6 +681,7 @@ export function openStudio(node, {extendFrom = null} = {}) {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;+ sharedGpuNote.textContent = r.shared_gpu ? sharedGpuText(r.shared_gpu, t) : ''; sharedGpuNote.hidden = !sharedGpuNote.textContent || !!r.result_cache_hit;encoderNote.textContent = r.encoder_file ? encoderFileText(r.encoder_file, t) : ''; encoderNote.hidden = !r.encoder_file;const encoderPath = encoderFilePath(r.encoder_file);if (encoderPath) encoderNote.append(el('pre', encoderPath, 'fv-encoder-path'));