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.

Show first-time setup and the one slow-run cause on the range line

Bowen Xuea29b7f47e077
diff --git a/freevideo_engine/capabilities.py b/freevideo_engine/capabilities.py
index 4dee623..e732328 100644
--- a/freevideo_engine/capabilities.py
+++ b/freevideo_engine/capabilities.py
@@ -215,7 +215,8 @@ def _machine(machine, in_use=None):
vram_free=max(0, int(vram) - idle['vram']),
ram_available=max(0, int(ram) - idle['ram']), idle_in_use=idle,
cap=tuple(cap) if not mac else None, precision=precision,
- metal=int(metal) if metal is not None else None)
+ metal=int(metal) if metal is not None else None,
+ compile_owed=machine.get('compile_owed') is True and not mac)
def _request(width, height, frames, steps, two_pass, task='t2va', refine=3,
@@ -290,7 +291,8 @@ def _admit(machine, width, height, frames, steps, two_pass, task='t2va', refine=
disk_risk = any(e['stream_weights'] and e['pin_host_gb'] * 1e9 + 1e6
< (50 - e['resident_blocks']) * BLOCK_BYTES for e in engines)
transfers = any(e['residual_offload'] or e['attention_cpu_outputs'] for e in engines)
- return request, int(disk_risk or transfers), None
+ # The third value names what made a slow plan slow: host RAM (weights stream from disk) or GPU memory.
+ return request, int(disk_risk or transfers), 'memory' if disk_risk else 'gpu_memory' if transfers else None
except ResourceBudgetError as error:
# One field cannot encode both failures: prefer the system RAM limit.
return None, -1, 'memory' if 'ram' in error.details['insufficient'] else 'gpu_memory'
@@ -423,7 +425,7 @@ def build(machine, records, *, aspect='16:9', size=None, task='t2va', adapters=F
tiers = {}
for name, tier in quality_tiers.table(machine['mac']).items():
steps, two_pass, step_cache, upscale = tier['steps'], tier['two_pass'], tier['step_cache'], tier['upscale']
- times, codes, maxima, frame_maxima, limits = [], [], [], [], []
+ times, codes, slow_by, maxima, frame_maxima, limits = [], [], [], [], [], []
for size_row in sizes:
admitted = {f: _admit(machine, size_row['width'], size_row['height'], f, steps, two_pass, task,
references=references, step_cache=step_cache, upscale=upscale)
@@ -441,23 +443,27 @@ def build(machine, records, *, aspect='16:9', size=None, task='t2va', adapters=F
maxima.append(max((l['seconds'] for l in lengths if admitted[l['frames']][0] is not None),
default=None))
next_frame = maximum + 17 if maximum is not None else 39
- limits.append('panel' if next_frame > lengths[-1]['frames'] else admitted[next_frame][2])
- row_times, row_codes = [], []
+ limits.append('panel' if next_frame > lengths[-1]['frames']
+ else admitted[next_frame][2] if admitted[next_frame][0] is None else None)
+ row_times, row_codes, row_slow = [], [], []
for length in lengths:
- request, code, _ = admitted[length['frames']]
+ request, code, why = admitted[length['frames']]
seconds = None
if request is not None:
seconds = max(1, math.floor(estimates[length['frames']] + .5))
row_times.append(seconds)
row_codes.append(code)
+ row_slow.append(why if code > 0 else None)
times.append(row_times)
codes.append(row_codes)
+ slow_by.append(row_slow)
tiers[name] = dict(steps=steps, two_pass=two_pass, step_cache=step_cache, upscale=upscale, estimate_seconds=times,
- max_seconds=maxima, max_frames=frame_maxima, limit=limits, plan=codes)
+ max_seconds=maxima, max_frames=frame_maxima, limit=limits, plan=codes, slow_by=slow_by)
default = next((i for i, s in enumerate(sizes) if s['pixels'] == .98), 0)
result = dict(version=1, status='ready',
machine=dict(gpu_name=machine['name'], vram_gib=machine['vram'] / GiB,
- ram_gib=machine['ram'] / GiB, system=machine['system']),
+ ram_gib=machine['ram'] / GiB, system=machine['system'],
+ compile_owed=machine['compile_owed']),
aspect=aspect, sizes=sizes, lengths=lengths, tiers=tiers,
summary=dict(width=sizes[default]['width'], height=sizes[default]['height'], tier='light',
max_seconds=tiers['light']['max_seconds'][default],
diff --git a/freevideo_engine/comfy_capabilities.py b/freevideo_engine/comfy_capabilities.py
index a2daa4d..4ad9c07 100644
--- a/freevideo_engine/comfy_capabilities.py
+++ b/freevideo_engine/comfy_capabilities.py
@@ -28,8 +28,9 @@ def _hash(value):
def _context(output_directory):
+ from .background_compile import compile_owed
from .comfy_bridge import installation
- _, machine = installation()
+ root, machine = installation()
machine = dict(machine)
device = machine.get('device_identity') if machine.get('device_backend') == 'mps' else machine.get('gpu_uuid')
# Older machine.json stores totals only in its setup plan. Match the saved
@@ -49,6 +50,8 @@ def _context(output_directory):
if isinstance(machine.get('hardware'), dict):
observed.update(machine['hardware'])
machine['hardware'] = observed
+ # Receipt read only: tells the page the first run still compiles.
+ machine['compile_owed'] = compile_owed(root)
# Do not inherit the sampling-estimate route's 15-second history cache:
# reopening the grid after a generation must notice the new timing record.
rows = local_records(output_directory, device, system=machine.get('system'), stage_details=True, refresh=True)
diff --git a/web/capability_view.js b/web/capability_view.js
index d0c01f1..4e5dd3d 100644
--- a/web/capability_view.js
+++ b/web/capability_view.js
@@ -383,7 +383,25 @@ export function createCapabilityView({node, api, t, getState, onPick, onEstimate
const i = grid.sizes.findIndex(s => s.width === Number(value(node, 'width')) && s.height === Number(value(node, 'height')));
const j = grid.lengths.findIndex(l => l.seconds === Number(value(node, 'seconds')));
const seconds = tier?.estimate_seconds?.[i]?.[j];
- return positive(seconds) ? aboutTime(seconds, t) : '';
+ if (!positive(seconds)) return '';
+ // The suffix stays in one piece so a narrow line moves it whole to the next line.
+ return aboutTime(seconds, t) + (grid.machine?.compile_owed === true ? t(' · \u2060includes\u00a0first-time\u00a0setup', ' · \u2060含\u2060首\u2060次\u2060准\u2060备') : '');
+ }, warning(steps, twoPass, refine, stepCache = null, upscale = 2) {
+ if (!grid || !surface) return '';
+ const tier = gridTier(grid, steps, twoPass, refine, stepCache, upscale);
+ const i = grid.sizes.findIndex(s => s.width === Number(value(node, 'width')) && s.height === Number(value(node, 'height')));
+ const j = grid.lengths.findIndex(l => l.seconds === Number(value(node, 'seconds')));
+ const code = tier?.plan?.[i]?.[j];
+ if (!(code > 0) || !positive(tier.estimate_seconds?.[i]?.[j])) return '';
+ const why = tier.slow_by?.[i]?.[j];
+ const head = why === 'gpu_memory' ? t('Not enough graphics memory, so this will be slow.', '显存不足,这次会很慢。')
+ : why === 'memory' ? t('Not enough RAM, so this will be slow.', '内存不足,这次会很慢。') : t('This will be slow.', '这次会很慢。');
+ // One remedy only, and only when it really removes the slowdown.
+ const levels = effortsFrom(grid), at = levels.findIndex(l => grid.tiers?.[l.name.toLowerCase()] === tier);
+ const lower = at > 0 && levels.slice(0, at).some(l => { const row = grid.tiers?.[l.name.toLowerCase()]; return row?.plan?.[i]?.[j] === 0 && positive(row.estimate_seconds?.[i]?.[j]); });
+ if (lower) return head + t(' ', '') + t('Choose a lower Quality level.', '请把质量降低一档。');
+ const smaller = tier.plan.slice(0, i).some((row, k) => row[j] === 0 && positive(tier.estimate_seconds?.[k]?.[j]) && grid.sizes[k].pixels < grid.sizes[i].pixels);
+ return smaller ? head + t(' ', '') + t('Choose a smaller size.', '请缩小尺寸。') : head;
}, dispose() {
disposed = true; controller?.abort(); clearTimeout(retry); observer.disconnect();
api.removeEventListener('freevideo_capabilities', changed); window.removeEventListener('pointerdown', outside);
diff --git a/web/sampling_effort.css b/web/sampling_effort.css
index 1d68b87..e9391fa 100644
--- a/web/sampling_effort.css
+++ b/web/sampling_effort.css
@@ -7,6 +7,7 @@
.fv-effort{--fv-position:0;--fv-move:cubic-bezier(.25,1.15,.45,1);--fv-tone:var(--fv-accent,#6db8fa)}
.fv-effort-heading{display:flex;align-items:baseline;gap:8px;margin:0 0 10px;color:var(--fv-muted,#969a9f);font:12px/1.5 var(--fv-font,system-ui)}
.fv-effort-estimate{margin-left:auto;font-variant-numeric:tabular-nums;text-align:right;font-size:11px}
+.fv-effort-warning{margin:-4px 0 10px;color:var(--fv-warning);font:11px/1.5 var(--fv-font,system-ui);text-align:left}
.fv-effort-rail{position:relative;cursor:pointer;touch-action:pan-y;user-select:none;-webkit-user-select:none;outline:none;border-radius:20px}
/* A thick track in the interface's own accent; the knob travels inside it. */
.fv-effort-track{position:relative;display:block;height:36px;border-radius:18px;background:color-mix(in srgb,var(--fv-ink,#eee) 7%,transparent);box-shadow:inset 0 1px 2px #0005}
diff --git a/web/sampling_effort.js b/web/sampling_effort.js
index 4cb0fab..9656f6b 100644
--- a/web/sampling_effort.js
+++ b/web/sampling_effort.js
@@ -99,6 +99,7 @@ export function createSamplingEffort(t, {onChange, onPreview = () => {}, levels
const header = el('div', 'fv-effort-heading');
const label = el('span', '', t('Quality', '质量'));
const estimate = el('span', 'fv-effort-estimate');
+ const warning = el('div', 'fv-effort-warning'); warning.hidden = true;
// The names under the track show the level; the heading does not repeat it.
header.append(label, estimate);
const rail = el('div', 'fv-effort-rail'); rail.tabIndex = 0;
@@ -119,7 +120,7 @@ export function createSamplingEffort(t, {onChange, onPreview = () => {}, levels
names.append(b); return b;
});
const custom = el('span', 'fv-effort-custom', t('Custom steps', '自定义步数')); custom.hidden = true;
- element.append(header, rail, names, custom);
+ element.append(header, warning, rail, names, custom);
let selected = 0, disabled = false, pointer = null, draft = 0, currentSteps = 8, currentRefine = 3, twoPass = true, stepCache = null, upscale = 2, reason = '';
function paint(position) {
element.style.setProperty('--fv-position', position / 3);
@@ -200,5 +201,5 @@ export function createSamplingEffort(t, {onChange, onPreview = () => {}, levels
efforts = next;
update({baseSteps: currentSteps, refineSteps: currentRefine, twoPass, stepCache, upscale, disabled, reason});
}
- return {element, update, setLevels, levels: () => efforts, setEstimate(text, title = '') { estimate.textContent = text; if (title) estimate.title = title; else estimate.removeAttribute('title'); }, dispose: cancel};
+ return {element, update, setLevels, levels: () => efforts, setWarning(text) { warning.textContent = text; warning.hidden = !text; }, setEstimate(text, title = '') { estimate.textContent = text; if (title) estimate.title = title; else estimate.removeAttribute('title'); }, dispose: cancel};
}
diff --git a/web/studio.js b/web/studio.js
index 9893c74..950b870 100644
--- a/web/studio.js
+++ b/web/studio.js
@@ -1029,6 +1029,7 @@ export function openStudio(node, {extendFrom = null} = {}) {
return level?.name === 'Medium' ? t('A continuation uses the Medium level.', '接着生成使用标准档。') : t('A continuation uses the Light level.', '接着生成使用轻量档。');
}
function showEffortEstimate(steps = Number(baseSteps.value), twoPassPlan = twoPass.checked, cache = stepCacheNow(), factor = upscaleNow()) {
+ effort.setWarning('');
const parts = lengthControl.plan?.count > 1 ? t(`${lengthControl.plan.count} parts`, `分 ${lengthControl.plan.count} 段`) : '';
// A request that fits one run keeps its own estimate while the longest run is unknown.
if ((lengthControl.capabilityState === 'pending' || lengthControl.capabilityState === 'unavailable')
@@ -1048,7 +1049,11 @@ export function openStudio(node, {extendFrom = null} = {}) {
return;
}
const rangeEstimate = capabilityView?.estimate(steps, twoPassPlan, arguments.length ? 3 : Number(refineSteps.value), cache, factor);
- if (rangeEstimate) { effort.setEstimate(rangeEstimate); return; }
+ if (rangeEstimate) {
+ effort.setEstimate(rangeEstimate);
+ effort.setWarning(capabilityView.warning(steps, twoPassPlan, arguments.length ? 3 : Number(refineSteps.value), cache, factor));
+ return;
+ }
const mode = twoPassPlan ? 'two_pass' : 'single';
// Keys: "<steps>[:<cache>][x<factor> when two-pass and not 2]".
const estimate = effortEstimate[mode]?.[`${steps}${cache ? ':' + cache : ''}${twoPassPlan && factor !== 2 ? 'x' + factor : ''}`];