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 physical RAM and commit headroom separately in resource refusals and feedback

Bowen Xued98a52579fde
diff --git a/freevideo_engine/feedback.py b/freevideo_engine/feedback.py
index 2c2f0c2..d34d065 100644
--- a/freevideo_engine/feedback.py
+++ b/freevideo_engine/feedback.py
@@ -15,6 +15,10 @@ TOKEN = re.compile(r'\b[A-Za-z0-9_\-]{32,}\b')
HARDWARE_KEYS = ('gpu_name', 'vram_total', 'ram_total', 'system', 'architecture', 'driver_version',
'torch_version', 'cuda_version')
+# Free physical RAM and commit headroom stay apart: a refusal text is cut
+# short, and the two numbers say which of them left too little.
+MEMORY_KEYS = ('physical_available_bytes', 'commit_available_bytes', 'available_bytes', 'total_bytes')
+
def scrub(value):
return TOKEN.sub('<token>', PATH.sub('<path>', str(value)))
@@ -37,13 +41,19 @@ def summary(report, machine=None):
for key in ('version', 'status', 'request_seconds', 'geometry', 'config', 'stages', 'budgets'):
if key in analysis:
out[key] = analysis[key]
+ planning = analysis.get('resource_planning')
+ memory = planning[-1].get('system_memory') if isinstance(planning, list) and planning and isinstance(planning[-1], dict) else None
+ if isinstance(memory, dict):
+ memory = {k: memory[k] for k in MEMORY_KEYS if type(memory.get(k)) is int}
+ if memory:
+ out['memory'] = memory
errors = analysis.get('errors')
if isinstance(errors, list):
out['errors'] = [scrub(e)[:300] for e in errors[:3]]
if hardware:
out['hardware'] = hardware
# Bound the whole summary; drop the largest optional parts first.
- for key in ('stages', 'config', 'errors', 'budgets', 'geometry'):
+ for key in ('stages', 'config', 'errors', 'budgets', 'geometry', 'memory'):
if len(json.dumps(out, separators=(',', ':'), ensure_ascii=False)) <= MAX_DIAGNOSTICS:
break
out.pop(key, None)
diff --git a/freevideo_engine/hardware.py b/freevideo_engine/hardware.py
index 49b1e98..4970f9a 100644
--- a/freevideo_engine/hardware.py
+++ b/freevideo_engine/hardware.py
@@ -23,6 +23,8 @@ class Hardware:
cgroup_ram_limit: int | None = None
gpu_uuid: str = ''
driver_version: str = ''
+ ram_physical_available: int | None = None
+ ram_commit_available: int | None = None
@property
def architecture(self):
@@ -196,7 +198,8 @@ def detect():
limit, available = cgroup_capacity(include_reclaimable=True)
return replace(observed, ram_total=memory['total_bytes'],
ram_available=min(memory['available_bytes'], available) if available is not None else memory['available_bytes'],
- cgroup_ram_limit=limit)
+ cgroup_ram_limit=limit, ram_physical_available=memory.get('physical_available_bytes'),
+ ram_commit_available=memory.get('commit_available_bytes'))
def _detect_local():
@@ -223,7 +226,8 @@ def _detect_local():
pass
return Hardware(torch.cuda.get_device_name(index), torch.cuda.get_device_capability(index),
total, free, ram['total_bytes'], min(ram['available_bytes'], available) if available is not None else ram['available_bytes'],
- platform.system(), str(torch.__version__), str(torch.version.cuda), cap, uuid, driver)
+ platform.system(), str(torch.__version__), str(torch.version.cuda), cap, uuid, driver,
+ ram.get('physical_available_bytes'), ram.get('commit_available_bytes'))
def installed_backends():
diff --git a/freevideo_engine/policy.py b/freevideo_engine/policy.py
index d7a4ccd..44965c3 100644
--- a/freevideo_engine/policy.py
+++ b/freevideo_engine/policy.py
@@ -545,7 +545,9 @@ class ResourceBudgetError(ValueError):
ram_total_bytes=hardware.ram_total, ram_capacity_bytes=ram_total,
ram_available_bytes=free_ram, ram_reserve_bytes=int(reserve_ram * GiB),
ram_budget_bytes=free_ram-int(reserve_ram * GiB), ram_minimum_bytes=ram_minimum_bytes,
- cgroup_ram_limit_bytes=hardware.cgroup_ram_limit)
+ cgroup_ram_limit_bytes=hardware.cgroup_ram_limit,
+ ram_physical_available_bytes=hardware.ram_physical_available,
+ ram_commit_available_bytes=hardware.ram_commit_available)
failed = [name for name in ('gpu', 'ram')
if self.details[name+'_budget_bytes'] < self.details[name+'_minimum_bytes']]
self.details['insufficient'] = failed
@@ -587,6 +589,9 @@ class ResourceBudgetError(ValueError):
self.details[name+'_total_bytes']/GiB))
if self.details[name+'_shortfall_bytes']:
lines.append('%s shortfall: %.2f GiB.' % (label, self.details[name+'_shortfall_bytes']/GiB))
+ if hardware.ram_commit_available is not None and hardware.ram_physical_available is not None:
+ lines.append('Windows reports %.2f GiB of free physical RAM and %.2f GiB of commit headroom.' %
+ (hardware.ram_physical_available / GiB, hardware.ram_commit_available / GiB))
lines.append('Available memory includes validated idle-cache credit, if present. Resolution, frames and steps were not reduced.')
super().__init__('\n'.join(lines))