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.

One completed generation restores the level raised after an interruption of unknown cause

Bowen Xuee8c14e55ca81
diff --git a/freevideo_engine/compatibility.py b/freevideo_engine/compatibility.py
index 14ad4d7..59e2c71 100644
--- a/freevideo_engine/compatibility.py
+++ b/freevideo_engine/compatibility.py
@@ -25,6 +25,9 @@ LEVELS = (
dict(level=3, en='Strong · the GPU handles the least at a time; slowest', zh='加强 · 显卡每次处理的数据最少,生成最慢', head=1),
)
RECOVERY_SUCCESSES = 3
+# An interruption whose cause is unknown leaves no sign that the wider work grouping was at fault,
+# so one completed generation restores the previous level; a reported GPU error keeps the full streak.
+UNEXPLAINED_INTERRUPTIONS = ('unfinished_request_after_owner_and_worker_exit', 'unknown_worker_exit')
SUCCESS_RECEIPTS = 64
@@ -52,6 +55,11 @@ def policy_revision():
return digest.hexdigest()
+def recovery_required(state):
+ reason = (state.get('trigger') or state.get('notice') or {}).get('reason')
+ return 1 if reason in UNEXPLAINED_INTERRUPTIONS else RECOVERY_SUCCESSES
+
+
def current_settings(value):
value = copy.deepcopy(value)
revision = policy_revision()
@@ -183,7 +191,8 @@ class Store:
if key is None:
return unavailable()
if not io_path(self.path).exists():
- return dict(current_settings(dict(level=0, automatic=True, notice=None)), levels=LEVELS, available=True)
+ return dict(current_settings(dict(level=0, automatic=True, notice=None)), levels=LEVELS, available=True,
+ recovery_successes_required=RECOVERY_SUCCESSES)
with closing(sqlite3.connect(_read_uri(self.path), uri=True, timeout=10)) as db:
value = self.read_row(db, key)
selected = current_settings(value)
@@ -192,7 +201,7 @@ class Store:
# Re-read under the lock so a concurrent user edit always wins.
selected = current_settings(self.read_row(db, key))
self.write_row(db, key, selected)
- return dict(selected, levels=LEVELS, available=True)
+ return dict(selected, levels=LEVELS, available=True, recovery_successes_required=recovery_required(selected))
def set(self, identity, level, automatic):
if type(level) is not int or not 0 <= level <= 3 or type(automatic) is not bool:
@@ -248,7 +257,7 @@ class Store:
# once, and so does one that was already running at the last counted interruption.
# A request is registered after recovery in the same call, often within one tick
# of a coarse system clock, so an equal time counts.
- elif (reason in ('unfinished_request_after_owner_and_worker_exit', 'unknown_worker_exit')
+ elif (reason in UNEXPLAINED_INTERRUPTIONS
and row['started'] >= value.get('last_counted_interruption', 0)
and (batch is None or batch != value.get('last_counted_batch'))):
incident['counted'] = True
@@ -308,12 +317,13 @@ class Store:
recovery = None
if restoring:
value['consecutive_successes'] += 1
- if value['consecutive_successes'] >= RECOVERY_SUCCESSES:
+ required = recovery_required(value)
+ if value['consecutive_successes'] >= required:
previous = value['level']
value['level'] = max(value['manual_level'], 2 if previous == 3 else 0)
if value['level'] < previous:
recovery = dict(id=row['id'], reason='consecutive_successes', previous_level=previous,
- level=value['level'], successes=RECOVERY_SUCCESSES,
+ level=value['level'], successes=required,
policy_revision=revision, time=time.time())
value['recovery'] = recovery
if value['manual_level'] and value['level'] == value['manual_level']:
@@ -326,7 +336,7 @@ class Store:
value['notice']['level'] = value['level']
result = dict(unknown_interruptions=value['unknown_interruptions'],
consecutive_successes=value['consecutive_successes'],
- recovery_successes_required=RECOVERY_SUCCESSES,
+ recovery_successes_required=recovery_required(value),
recovery_disabled=value['recovery_disabled'])
if recovery:
result['recovery'] = recovery
@@ -367,7 +377,7 @@ def apply(profile, state):
numerical_class='chunking-may-change-floating-point-results' if changes else 'unchanged')
decision.update(unknown_interruptions=state.get('unknown_interruptions', 0),
consecutive_successes=state.get('consecutive_successes', 0),
- recovery_successes_required=RECOVERY_SUCCESSES,
+ recovery_successes_required=recovery_required(state),
recovery_disabled=state.get('recovery_disabled', False))
for field in ('origin', 'policy_revision', 'reset', 'notice', 'trigger', 'recovery'):
if field in state:
diff --git a/freevideo_engine/compatibility_copy.py b/freevideo_engine/compatibility_copy.py
index 40eebea..64eee64 100644
--- a/freevideo_engine/compatibility_copy.py
+++ b/freevideo_engine/compatibility_copy.py
@@ -6,5 +6,9 @@ def notice_text(state, zh=False):
if state.get('recovery_disabled'):
return ('为了稳定,生成已自动放慢;可在设置里调整。' if zh else
'Generation is slowed automatically for stability; you can change this in Settings.')
- return (f'为了稳定,生成已自动放慢;连续完成 {RECOVERY_SUCCESSES} 次后会加快一些,也可在设置里调整。' if zh else
- f'Generation is slowed automatically for stability; it speeds up after {RECOVERY_SUCCESSES} successful generations in a row, or you can change this in Settings.')
+ required = state.get('recovery_successes_required') or RECOVERY_SUCCESSES
+ if required == 1:
+ return ('为了稳定,生成已自动放慢;下一次生成完成后会加快一些,也可在设置里调整。' if zh else
+ 'Generation is slowed automatically for stability; it speeds up after the next successful generation, or you can change this in Settings.')
+ return (f'为了稳定,生成已自动放慢;连续完成 {required} 次后会加快一些,也可在设置里调整。' if zh else
+ f'Generation is slowed automatically for stability; it speeds up after {required} successful generations in a row, or you can change this in Settings.')
diff --git a/web/compatibility.js b/web/compatibility.js
index 78fc7fa..bff9785 100644
--- a/web/compatibility.js
+++ b/web/compatibility.js
@@ -110,8 +110,11 @@ export async function notifyCompatibility() {
const panel = dialog(t('Compatibility enabled', '已开启兼容性设置'));
const message = element('p', value.recovery_disabled
? t('Generation is slowed automatically for stability; you can change this in Settings.', '为了稳定,生成已自动放慢;可在设置里调整。')
- : t('Generation is slowed automatically for stability; it speeds up after 3 successful generations in a row, or you can change this in Settings.',
- '为了稳定,生成已自动放慢;连续完成 3 次后会加快一些,也可在设置里调整。'));
+ : value.recovery_successes_required === 1
+ ? t('Generation is slowed automatically for stability; it speeds up after the next successful generation, or you can change this in Settings.',
+ '为了稳定,生成已自动放慢;下一次生成完成后会加快一些,也可在设置里调整。')
+ : t('Generation is slowed automatically for stability; it speeds up after 3 successful generations in a row, or you can change this in Settings.',
+ '为了稳定,生成已自动放慢;连续完成 3 次后会加快一些,也可在设置里调整。'));
panel.actions.before(message);
const finish = async (settings) => {
try { await request('ack', {notice_id: value.notice.id}); panel.close(); if (settings) await openCompatibility(); }