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.
Image generation: say where graphics memory ran out and at what size, show the retry size
Bowen Xued44019688309
diff --git a/web/cast_generate.js b/web/cast_generate.jsindex 4eae26f..e7a7524 100644--- a/web/cast_generate.js+++ b/web/cast_generate.js@@ -14,7 +14,8 @@ const VIEW_TITLES = Object.freeze({});function el(tag, cls, text) { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; }-const failureOf = error => ({error: error?.code || 'generation_failed', report_id: error?.report_id || null});+const failureOf = error => ({error: error?.code || 'generation_failed', report_id: error?.report_id || null,+ stage: error?.stage || '', fitted: error?.fitted || null});const randomSeed = () => crypto.getRandomValues(new Uint32Array(1))[0] >>> 1;// The five pictures of one description. No DOM: the page below draws its state.@@ -40,7 +41,8 @@ export function createCastGenerator({client, onChange = () => {}, schedule = setconst status = await client.status(job);if (!alive()) return null;if (status.state === 'error') {- throw Object.assign(new Error(status.error), {code: status.error, report_id: status.report_id});+ throw Object.assign(new Error(status.error), {code: status.error, report_id: status.report_id,+ stage: status.stage, fitted: status.fitted});}if (status.state === 'done') {if (!status.file) throw new Error('generation_failed');@@ -175,7 +177,7 @@ export function mountCastGenerate({container, api, text, t = text, viewURL, onStcell.fill.style.width = (active ? row.fraction * 100 : 0) + '%';});if (state.error) {- const key = `${state.error}:${state.report_id || ''}`;+ const key = `${state.error}:${state.report_id || ''}:${state.stage || ''}`;if (failureKey !== key) { renderImageFailure(note, state, tr, {fetchApi: fetcher}); failureKey = key; }} else {failureKey = null;diff --git a/web/image_generation.js b/web/image_generation.jsindex 6279cea..52fc6ef 100644--- a/web/image_generation.js+++ b/web/image_generation.js@@ -36,6 +36,7 @@ export function blankCanvasSize(ratio, sizes = null) {}const failure = (code, info = {}) => Object.assign(new Error(code || 'generation_failed'), {code: code || 'generation_failed', report_id: info.report_id || null, stage: info.stage || '',+ fitted: info.fitted || null,});export function createImageGenClient(fetchImpl = globalThis.fetch.bind(globalThis)) {@@ -123,6 +124,20 @@ export function imageGenError(code, info, t) {generation_failed: ['Image generation ran into an error. Try again.', '图像生成出错了,请再试一次。'],};if (code === 'pack_missing') return imagePackUnavailableMessage(info, t);+ if (code === 'no_memory') {+ // Where it ran out decides what helps: the reference pictures are read at a fixed size,+ // so a smaller canvas does not change that stage.+ const stage = info?.stage, size = info?.fitted;+ if (stage === 'encode')+ return t('Not enough GPU memory to load the reference images. Use fewer reference images, or close other apps using the GPU, then try again.',+ '显存不够,参考图没能载入。少用几张参考图,或关掉其他占用显卡的程序后再试。');+ if (stage === 'load' || stage === 'text')+ return t('Not enough GPU memory to load the model. Close other apps using the GPU, then try again.',+ '显存不够,模型没能载入。关掉其他占用显卡的程序后再试。');+ if (size?.width && size?.height)+ return t(`Not enough GPU memory, even at ${size.width}\u00a0×\u00a0${size.height}. Close other apps using the GPU, then try again.`,+ `显存不够,${size.width}\u00a0×\u00a0${size.height} 也没能生成。关掉其他占用显卡的程序后再试。`);+ }return t(...(Object.hasOwn(reasons, code) ? reasons[code] : reasons.generation_failed));}@@ -144,7 +159,7 @@ export const REPORT_LABELS = Object.freeze({// Shared by the editor and the other image entry points. Only the opaque report// ID goes in the request; raw service messages are never shown in the page.-export function renderImageFailure(host, {error, report_id} = {}, t,+export function renderImageFailure(host, {error, report_id, stage, fitted} = {}, t,{productVersion = () => null, fetchApi = globalThis.fetch.bind(globalThis)} = {}) {host.replaceChildren();if (!error || error === 'cancelled') return null;@@ -155,7 +170,7 @@ export function renderImageFailure(host, {error, report_id} = {}, t,}const card = doc.createElement('div'); card.className = 'fv-result-links';const reason = doc.createElement('div'); reason.className = 'fv-image-failure-reason';- reason.setAttribute('role', 'status'); reason.textContent = imageGenError(error, null, t);+ reason.setAttribute('role', 'status'); reason.textContent = imageGenError(error, {stage, fitted}, t);card.append(reason); host.append(card);if (!report_id) return card;const fetchReport = async () => {@@ -297,7 +312,8 @@ export function createImageGenSession({client, prepare, apply, onChange = () =>waiting: '', fitted: null};const emit = patch => { state = {...state, ...patch}; if (!disposed) onChange(state); };const failed = error => error.code === 'cancelled' ? {error: '', report_id: null, stage: ''}- : {error: error.code || 'generation_failed', report_id: error.report_id || null, stage: error.stage || ''};+ : {error: error.code || 'generation_failed', report_id: error.report_id || null, stage: error.stage || '',+ ...(error.fitted ? {fitted: error.fitted} : {})};const cancelJob = job => Promise.resolve().then(() => client.cancel(job)).catch(() => {});const forget = () => { try { store?.clear(); } catch { /* the job is only not resumed after a reload */ } };function scheduleInfo() {@@ -546,7 +562,7 @@ export function createImageGeneration({client, renderer, t, getDoc, getSelectionaction.hidden = !!missing;const percent = Math.floor(state.fraction * 100) + '%';if (state.error && !promptRequired) {- const failureKey = `${state.error}:${state.report_id || ''}`;+ const failureKey = `${state.error}:${state.report_id || ''}:${state.stage || ''}`;if (mounted.failureKey !== failureKey) {renderImageFailure(note, state, t, {productVersion, fetchApi});mounted.failureKey = failureKey;@@ -556,6 +572,8 @@ export function createImageGeneration({client, renderer, t, getDoc, getSelectionnote.textContent = missing ? imagePackUnavailableMessage(state.info, t): promptRequired ? t('Write a short description first.', '请先写一句画面描述。'): state.running && state.waiting ? t(...(QUEUE_LABELS[state.waiting] || QUEUE_LABELS.image))+ : state.running && state.fitted ? t(`Not enough GPU memory. Retrying at ${state.fitted.width}\u00a0×\u00a0${state.fitted.height}`,+ `显存不足,改用 ${state.fitted.width}\u00a0×\u00a0${state.fitted.height} 重试`) + ' · ' + percent: state.running ? (state.stage === 'load' ? t('Loading the model', '加载模型') + ' ' : '') + percent: state.fitted ? fittedNote(state.fitted, t) : '';}