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.

Record the memory a Mac reported when native generation is refused at the start

Bowen Xue221bb22af0d7
diff --git a/freevideo_engine/macos_generate.py b/freevideo_engine/macos_generate.py
index 85dd616..4b305b5 100644
--- a/freevideo_engine/macos_generate.py
+++ b/freevideo_engine/macos_generate.py
@@ -46,7 +46,12 @@ def policy(args, memory=None):
capacity = min(memory['total_bytes'], amount('ram_gib', memory['total_bytes']))
working = min(capacity, memory['available_bytes']) - reserve
if working < 2 * GiB:
- raise MemoryError('Native generation needs at least 2 GiB working unified memory after the system reserve')
+ error = MemoryError('Native generation needs at least 2 GiB working unified memory after the system reserve')
+ # What the system reported at this moment, so the report shows whether the Mac is small or busy.
+ error.memory_record = dict(total_bytes=memory['total_bytes'], available_bytes=memory['available_bytes'], reserve_bytes=reserve)
+ if getattr(args, 'ram_gib', None) is not None:
+ error.memory_record['launcher_limit_bytes'] = amount('ram_gib', None)
+ raise error
# The original 4 GiB cap was a small-workload trial, not a device capacity.
# Use the live unified allowance. The native backend additionally clamps it
# to Metal's recommendation and rechecks availability when the worker starts.
@@ -364,6 +369,8 @@ def run(args):
except BaseException as error:
report.update(error_type=type(error).__name__, error_message=str(error), exception=traceback.format_exc(),
cancelled=isinstance(error, KeyboardInterrupt))
+ if getattr(error, 'memory_record', None):
+ report['preflight_memory'] = error.memory_record
raise
finally:
processes.restore_handlers(previous)
diff --git a/freevideo_engine/support_report.py b/freevideo_engine/support_report.py
index 6e44f2b..3c2d0ce 100644
--- a/freevideo_engine/support_report.py
+++ b/freevideo_engine/support_report.py
@@ -249,7 +249,7 @@ def summarize(report, engine, encoding):
REQUEST_FIELDS = ('seed', 'encoder_mode', 'profile', 'resource_planning', 'compatibility',
'reclaimable_resident_models', 'idle_resources', 'tuning', 'input_cache', 'resource_attempts',
'resource_prediction', 'resource_prediction_error', 'error', 'error_message', 'error_type',
- 'resource_error', 'exception', 'encoding_failure', 'phase', 'continuation')
+ 'resource_error', 'exception', 'encoding_failure', 'phase', 'continuation', 'preflight_memory')
def preview_receipts(output, read_json):
diff --git a/web/error_panel.js b/web/error_panel.js
index 54d6e17..16e713f 100644
--- a/web/error_panel.js
+++ b/web/error_panel.js
@@ -392,7 +392,12 @@ export function failureAdvice(value, t, known = knownError(value)) {
return row('unified-memory-limit', ['Not enough unified memory', '统一内存不足'],
['These settings need more memory than the device can provide.', '这组设置需要的内存超过设备上限。'],
['Choose a lower resolution or a shorter duration and retry.', '请降低分辨率或缩短时长后重试。']);
- if (/MPS backend out of memory|MPS (?:generation|encoding|decoding) reached|No unified-memory allowance|Native generation needs at least .* unified memory/i.test(text))
+ // The start-of-request check does not depend on the settings, so lowering them is no advice here.
+ if (/Native generation needs at least .* unified memory/i.test(text))
+ return row('unified-memory', ['Not enough unified memory', '统一内存不足'],
+ ['This Mac does not have enough free memory right now to start this generation.', '这台 Mac 当前可用的内存不足以开始这次生成。'],
+ ['Close other memory-heavy applications and retry. Export the report if it still fails.', '请关闭其他占用内存较多的程序后重试。仍然失败时,请导出报告。']);
+ if (/MPS backend out of memory|MPS (?:generation|encoding|decoding) reached|No unified-memory allowance/i.test(text))
return row('unified-memory', ['Not enough unified memory', '统一内存不足'],
['Generation needed more memory than was available.', '生成所需内存超过当时可用量。'],
['Close memory-heavy applications, or lower the resolution or duration, then retry. Export the report if it still fails.', '可关闭占用内存较多的程序,或调低分辨率、缩短时长后重试。仍然失败时,请导出报告。']);