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.
Let users type LoRA strengths beyond the usual range
Bowen Xue172421ae5a5c
diff --git a/freevideo_engine/comfy_assets.py b/freevideo_engine/comfy_assets.pyindex 266d877..19545ba 100644--- a/freevideo_engine/comfy_assets.py+++ b/freevideo_engine/comfy_assets.py@@ -48,8 +48,8 @@ def resolve_loras(serialized, names, resolve, previous=None):continuename, strength = row.get('name'), row.get('strength', 1.)if (isinstance(strength, bool) or not isinstance(strength, (int, float))- or not math.isfinite(strength) or not -4 <= strength <= 4):- raise ValueError('LoRA strength must be a finite number between -4 and 4')+ or not math.isfinite(strength) or not -100 <= strength <= 100):+ raise ValueError('LoRA strength must be a finite number between -100 and 100')if not isinstance(name, str) or name not in available or not name.lower().endswith('.safetensors'):raise ValueError('Select an available safetensors LoRA from your ComfyUI model folders')if strength != 0:diff --git a/freevideo_engine/comfy_nodes.py b/freevideo_engine/comfy_nodes.pyindex 1bc24ce..725e62f 100644--- a/freevideo_engine/comfy_nodes.py+++ b/freevideo_engine/comfy_nodes.py@@ -404,7 +404,7 @@ class FreeVideoLoRA(io.ComfyNode):return io.Schema(node_id='FreeVideoLoRA', display_name='FreeVideo · LoRA', category='FreeVideo',description='FreeVideo needs no acceleration LoRA.',inputs=[io.Combo.Input('lora', options=[NO_LORA, *names]),- io.Float.Input('strength', default=1., min=-4., max=4., step=.05),+ io.Float.Input('strength', default=1., min=-100., max=100., step=.05),LoRAs.Input('previous', optional=True)], outputs=[LoRAs.Output('loras')])@classmethoddiff --git a/web/studio.css b/web/studio.cssindex e0cb7e0..f25d467 100644--- a/web/studio.css+++ b/web/studio.css@@ -143,6 +143,7 @@.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)}.fv-lora-list{display:flex;flex-direction:column;gap:8px;margin:12px 0}.fv-lora-row{display:grid;grid-template-columns:18px minmax(0,1fr) 64px 30px;align-items:center;gap:7px}.fv-lora-row select{min-width:0!important;max-width:100%!important;width:100%!important}.fv-lora-row input[type=number]{width:64px!important;padding:6px!important;font-variant-numeric:tabular-nums}.fv-lora-row input[type=checkbox]{accent-color:var(--fv-accent);width:15px;min-height:15px}+.fv-lora-range{grid-column:2/5;grid-row:3;justify-self:end;font-size:12px;line-height:16px;white-space:nowrap;color:var(--fv-muted)}.fv-lora-range[hidden]{display:none}.fv-lora-row[data-enabled=false]{opacity:.45}.fv-lora-order{grid-column:2/5;display:flex;gap:5px;justify-content:flex-end}.fv-lora-row .fv-lora-trigger{grid-column:2/5;grid-row:2;width:100%;min-width:0;min-height:28px;height:28px;box-sizing:border-box;border:1px solid var(--fv-border);border-radius:var(--fv-r-sm);padding:4px 8px;background:var(--fv-card);color:var(--fv-ink);font:inherit;font-size:var(--fv-micro)}.fv-lora-trigger::placeholder{color:var(--fv-disabled)}diff --git a/web/studio.js b/web/studio.jsindex e828131..2816d03 100644--- a/web/studio.js+++ b/web/studio.js@@ -45,6 +45,23 @@ const languageOverride = typeof location !== 'undefined'const cn = languageOverride === 'zh' || (languageOverride !== 'en'&& String(navigator.language || '').toLowerCase().startsWith('zh'));const t = (en, zh) => cn ? zh : en;+// The usual LoRA strength range is -4 to 4; a value the user types by hand may go further, up to 100.+const LORA_USUAL = 4, LORA_LIMIT = 100;+let loraRangeCount = 0;+function loraStrengthBox(initial, commit) {+ const input = document.createElement('input'), mark = document.createElement('span');+ input.type = 'number'; input.step = '.05'; input.value = initial;+ mark.id = 'fv-lora-range-' + ++loraRangeCount; input.setAttribute('aria-describedby', mark.id);+ mark.className = 'fv-lora-range'; mark.textContent = t('Outside usual range', '超出常用范围');+ const sync = () => {+ const number = Number(input.value), filled = input.value !== '';+ mark.hidden = !(filled && Math.abs(number) > LORA_USUAL && Math.abs(number) <= LORA_LIMIT);+ input.setCustomValidity(filled && !(Math.abs(number) <= LORA_LIMIT) ? t('Enter a value from -100 to 100.', '请输入 -100 到 100 之间的数。') : '');+ };+ input.oninput = sync; input.onchange = () => { sync(); if (input.reportValidity()) commit(); };+ sync();+ return {input, mark};+}const css = document.createElement('link'); css.rel = 'stylesheet'; css.href = new URL('./studio.css', import.meta.url).href; document.head.append(css);const effortCss = document.createElement('link'); effortCss.rel = 'stylesheet'; effortCss.href = new URL('./sampling_effort.css', import.meta.url).href; document.head.append(effortCss);const enhanceCss = document.createElement('link'); enhanceCss.rel = 'stylesheet'; enhanceCss.href = new URL('./prompt_enhance.css', import.meta.url).href; document.head.append(enhanceCss);@@ -306,8 +323,8 @@ export function loraPanel(node, panel, {promptNode = null} = {}) {const pinned = recentLoras().filter(n => names.includes(n));for (const name of [...new Set([...pinned, ...names, row.name])].filter(Boolean)) { const option = el('option', name); option.value = name; select.append(option); }select.value = row.name; select.title = row.name; select.onchange = () => { row.name = select.value; rememberLora(row.name); write(rows); };- const strength = el('input'); strength.type = 'number'; strength.min = '-4'; strength.max = '4'; strength.step = '.05'; strength.value = row.strength ?? 1;- strength.setAttribute('aria-label', t('LoRA strength', 'LoRA 强度')); strength.onchange = () => { if (strength.reportValidity() && strength.value !== '') { row.strength = Number(strength.value); write(rows); } };+ const {input: strength, mark: strengthMark} = loraStrengthBox(row.strength ?? 1, () => { if (strength.value !== '') { row.strength = Number(strength.value); write(rows); } });+ strength.setAttribute('aria-label', t('LoRA strength', 'LoRA 强度'));const trigger = el('input', null, 'fv-lora-trigger'); trigger.type = 'text'; trigger.maxLength = 300;trigger.dataset.name = row.name;trigger.placeholder = t('Trigger words', '触发词'); trigger.setAttribute('aria-label', trigger.placeholder);@@ -332,7 +349,7 @@ export function loraPanel(node, panel, {promptNode = null} = {}) {};select.disabled = strength.disabled = trigger.disabled = row.enabled === false;const remove = button('×', () => { rows.splice(index, 1); write(rows); }); remove.setAttribute('aria-label', t('Remove LoRA', '移除 LoRA'));- wrap.append(enabled, select, strength, remove, trigger);+ wrap.append(enabled, select, strength, remove, trigger, strengthMark);if (rows.length > 1) {const order = el('div', null, 'fv-lora-order');for (const [label, delta] of [['↑', -1], ['↓', 1]]) {@@ -708,8 +725,8 @@ export function openStudio(node, {extendFrom = null} = {}) {const select = el('select'); select.setAttribute('aria-label', t('LoRA model', 'LoRA 模型'));for (const name of widget(loraNode, 'lora').options?.values || ['None']) { const o = el('option', name); o.value = name; select.append(o); }select.value = value(loraNode, 'lora'); select.onchange = () => { set(loraNode, 'lora', select.value); requestAssets?.refresh(); };- const strength = el('input'); strength.type = 'number'; strength.min = '-4'; strength.max = '4'; strength.step = '.05'; strength.value = value(loraNode, 'strength'); strength.onchange = () => { if (strength.reportValidity()) { set(loraNode, 'strength', Number(strength.value)); requestAssets?.refresh(); } };- loraMount.append(field(t('LoRA', 'LoRA'), select), field(t('Strength', '强度'), strength), el('p', loraWarning(), 'fv-lora-note'));+ const {input: strength, mark: strengthMark} = loraStrengthBox(value(loraNode, 'strength'), () => { set(loraNode, 'strength', Number(strength.value)); requestAssets?.refresh(); });+ loraMount.append(field(t('LoRA', 'LoRA'), select), field(t('Strength', '强度'), strength), strengthMark, el('p', loraWarning(), 'fv-lora-note'));} else loraMount.append(el('p', loraWarning(), 'fv-lora-note'));const [, advanced] = expand(t('Advanced', '高级选项'));const custom = el('div', null, 'fv-fields');