Native Windows video motion capture with ExMR, FlowHMR and GVHMR, contact correction, humanoid retargeting, and FBX/VMD export.
Python
Add optional resource safety controls and update guides
toyxyzadf0bca0be33
diff --git a/AGENTS.md b/AGENTS.mdindex a210ea0..73a0ee1 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -15,4 +15,5 @@ the optional DroidCalib/LieTorch moving-camera build, follow- PEAR is a transient single-person bone preview. Selecting it must not start models or modify an offline project. Start/Stop controls the resident worker; see `docs/models/PEAR.md` for fixed bones, Reset Bones, One Euro filtering and World Position. Keep inference and capture off the GUI thread, use bounded latest-frame queues and preserve offline state on exit.- Treat local `models/`, `projects/`, `cache/`, `character_scenes/`, runtime folders, external project folders and registered model data as user-owned. Do not delete, overwrite, upload or migrate them without appropriate user authorization. Ignore rules are not backups.- Preserve inference and selected-result behavior when working on preview, contacts or export. Review the relevant code and validation records before changing numerical processing.+- Resource Safety defaults on below Resource Mode. Its local `config/local.json` preference controls measured low-RAM/commit stopping and the PyTorch VRAM allocator cap, including PEAR workers. Off must retain adaptive routing, actual OOM recovery, stall detection and generation protection. Do not save it in projects or inference identities; see `docs/PERFORMANCE.md#resource-safety`.- Follow the user's request and perform checks appropriate to the change. Do not claim an inference, import, export, GPU, playback or clean-install test that was not actually run.diff --git a/README.md b/README.mdindex 406fa96..9c5c98c 100644--- a/README.md+++ b/README.md@@ -201,7 +201,10 @@ Start with **Resource Mode > Automatic**. It uses the fast supported path whenmemory permits and falls back to a supported Low Memory path when needed.Memory-saving methods depend on the model; **Low Memory** can trade slowerloading/transfers and more system RAM for lower VRAM use. See each model's guide-for implemented options and limits.+for implemented options and limits. **Resource Safety**, below Resource Mode,+defaults on. Turn it off to bypass low-RAM stopping and the VRAM allocator limit;+Automatic batching and actual allocation-error handling stay active. See the+[Resource Safety details](docs/PERFORMANCE.md#resource-safety).Short paired tests reduced peak allocated VRAM from **5.68 to 3.87 GiB** for ExMRand **6.10 to 2.77 GiB** for FlowHMR. Separate short-clip tests of connecteddiff --git a/SOURCE_MANIFEST.json b/SOURCE_MANIFEST.jsonindex caf23aa..65ae292 100644--- a/SOURCE_MANIFEST.json+++ b/SOURCE_MANIFEST.json@@ -1,6 +1,6 @@{"schema": 1,- "date": "2026-11-02",+ "date": "2026-11-03","purpose": "Public source distribution; excludes model weights and runtime binaries","version": "git-source","files": [@@ -16,8 +16,8 @@},{"path": "AGENTS.md",- "bytes": 2219,- "sha256": "990cdee8d94201aeef3781f0d7bdf3a83fde72f7c8137669b723a85837536f93"+ "bytes": 2606,+ "sha256": "ff439259a6d72aeeeb52ee5f432da7a439e0076b6fec22565df0fa98178a41f3"},{"path": "LICENSE",@@ -26,8 +26,8 @@},{"path": "README.md",- "bytes": 11858,- "sha256": "dc739192a3767d917c41bc5ed18dbfd1d1ac0d2619f90ca6eac1f63b7003504a"+ "bytes": 12123,+ "sha256": "3a69eb100ea5a0c85eef2f436713f26a09d5f87a3c4f0cbb7af44340e9f06355"},{"path": "RGBMoCap.cmd",@@ -96,8 +96,8 @@},{"path": "docs/AGENT_GUIDE.md",- "bytes": 63148,- "sha256": "b1149d40f8b54cf05f3be2017022cc57458d874ea323e4e2e9d12d53107795a2"+ "bytes": 64392,+ "sha256": "88380a9503b24a012ef7c5e6bdaf81f31b88ecc900f1ae6f6242a1f1fe87c74d"},{"path": "docs/BUILD.md",@@ -111,8 +111,8 @@},{"path": "docs/MAMMA.md",- "bytes": 25972,- "sha256": "1682a83711942a29f64b7ec4b274bb1a6ee07dfb894d8a97e508825163b8326d"+ "bytes": 26044,+ "sha256": "b39269e68b68ad1d1644083114a4adab39a321b7a57430c2e299932b8448e350"},{"path": "docs/MAMMA_AGENT_SETUP.md",@@ -121,18 +121,18 @@},{"path": "docs/PERFORMANCE.md",- "bytes": 17525,- "sha256": "faa8145338009ec53f7ccac644e183fb66f24eb748e64d1a0b2eca77b899d197"+ "bytes": 19258,+ "sha256": "da8996dc115a98b6fa2fa872fa52cf4fe63db7ee7c81c59985b43eeb6e2d7e05"},{"path": "docs/USER_GUIDE.md",- "bytes": 62196,- "sha256": "5df7a603a8a18b7d030a109c339cb6f6a630861d55cc671d039b4c7e1034d95f"+ "bytes": 62771,+ "sha256": "a0bead1f7dfaf60d388248098fbc8115181f6d3d8c1d90890a86d2524ebbc51d"},{"path": "docs/VALIDATION.md",- "bytes": 129029,- "sha256": "347aeba0ddf06c49e77dbbb3cd7965125a80565601446861a53e76bbbb3463d7"+ "bytes": 131403,+ "sha256": "ac15b4c4d59d27c03a026cf82245112adf3b7b8c3d0b4aab28d39c98dd0c8a6d"},{"path": "docs/images/exmr-interaction-contact.png",@@ -156,33 +156,33 @@},{"path": "docs/models/EXMR.md",- "bytes": 9798,- "sha256": "63958a376407c3c995c4814d2d8f2e9858fd230d3b31871963eda24ff0a7cde4"+ "bytes": 9854,+ "sha256": "efb702c302376db8918dc71ea314033f7111e331c22d122ac191e6624bd9f6bd"},{"path": "docs/models/FLOWHMR.md",- "bytes": 13199,- "sha256": "96538bc5088537b59d91b42e6668136238adb6e9dc351bb4ddf0a9a4ff19fddb"+ "bytes": 13269,+ "sha256": "db85a1f7fb46f960e0732a36cddcd93776fdf7268d28f1be85f4c2ddedb61253"},{"path": "docs/models/GVHMR.md",- "bytes": 5936,- "sha256": "3d2d1470a448883d647f582d5a89112715abe26240632ba1168ac7a4e4795ef8"+ "bytes": 6057,+ "sha256": "bd3ec9b7e4192b3e860c4da6b58850da668d0c948effca4293afd01ba3844f0f"},{"path": "docs/models/PEAR.md",- "bytes": 23860,- "sha256": "b924da77cb6687dfa8cd4edfa5444b782bf90a45a500ee070c9d288554dba698"+ "bytes": 23965,+ "sha256": "cde9ccbfa48913eecd4659138a967c65aa1c2030557c6ec525cfd548ab393603"},{"path": "docs/models/PROMPTHMR.md",- "bytes": 20708,- "sha256": "ce4a64477b4b93dfdc4eb4045e6c3c722c1085d78a380cdeb2168dd9b765e4ad"+ "bytes": 20852,+ "sha256": "de76056793eefaab35694ba7fbaac3e0b95fb3e63998ff3796c1100c24f787d8"},{"path": "docs/models/README.md",- "bytes": 6648,- "sha256": "4ab9cd922cb7369f149ee9d245e3306e4c872609b2d956e622432d3ee76a1345"+ "bytes": 6785,+ "sha256": "27f52898cf4f7ff8f6dc9e8b29e6769cff708c6083fb9bcec8d0e44cece80385"},{"path": "docs/samples/character-retargeting.jpg",@@ -1211,8 +1211,8 @@},{"path": "mocap/compute_policy.py",- "bytes": 6073,- "sha256": "d355f7b37c395c9c745774399846880659b9b6a29d281ab5151480c2be4b6b3c"+ "bytes": 6147,+ "sha256": "9c8ca149a0d93075353308e93208d8831476f94d9f089a5b0b2b57253b5f1c0c"},{"path": "mocap/console_log.py",@@ -1381,8 +1381,8 @@},{"path": "mocap/gui.py",- "bytes": 106069,- "sha256": "ba28a7320d8957e25c386da2b0b58e98563af1349b127e747898db77c9600ee4"+ "bytes": 106907,+ "sha256": "e2d26a91298fbca7d427a8845d83ef3a7f28e35b634592c46f9b827837a2b09a"},{"path": "mocap/gvhmr_attention.py",@@ -1516,8 +1516,8 @@},{"path": "mocap/model_guide.py",- "bytes": 12178,- "sha256": "3a72db257f521458ceccda08be039338ab5b0ba0ef0ace82c42c36cb1d57da5f"+ "bytes": 12589,+ "sha256": "6b46a04d8023377ddc5460931fc1cf1c7030dae224828cf2b89591cbe9da2e1a"},{"path": "mocap/model_session.py",@@ -1567,7 +1567,7 @@{"path": "mocap/pear/align_worker.py","bytes": 10739,- "sha256": "acd9de6feda1bbbe76e36e588997bc4cc49a09b726ab5edeceddb4c24561fc96"+ "sha256": "9a73b8e53a0d40b710be2dd21ccb9a26b56cc106596b757d1b85912910f2da4d"},{"path": "mocap/pear/alignment_support.py",@@ -1671,8 +1671,8 @@},{"path": "mocap/pear/worker.py",- "bytes": 15037,- "sha256": "5622087c5a224cb1670206aa11aebfeca8e22c4b54eb3c034c48594b0d4ca856"+ "bytes": 15022,+ "sha256": "be8a47cd6db12b975fea99cbed79335078369ea2b83e0bbd67e4f28f5935ce75"},{"path": "mocap/pear_models.py",@@ -1746,8 +1746,8 @@},{"path": "mocap/processing_guard.py",- "bytes": 2783,- "sha256": "d440382289bda7479b5d3189661a9a784f7da4b48fe07a5971e6f5eabcad4be7"+ "bytes": 2999,+ "sha256": "62bacfbf9c1b73c68500ea5f49178124493d272965149ea177a13b5a27d73eba"},{"path": "mocap/progress_events.py",@@ -1781,8 +1781,8 @@},{"path": "mocap/prompthmr_cache.py",- "bytes": 4730,- "sha256": "2e11d39c67f75e514b039855537ad29fb430370b750b416cee3d79fcb2beb7e6"+ "bytes": 4945,+ "sha256": "cbf147b4a7b95e29a60fd20843593b9eaae091744755bde2441cf1861501b81d"},{"path": "mocap/prompthmr_camera.py",@@ -1806,8 +1806,8 @@},{"path": "mocap/prompthmr_pipeline.py",- "bytes": 13137,- "sha256": "d1075279956f9443c3ff80694a9388fc9e1f2d74b3af5f9dab0714c50c2a7687"+ "bytes": 13150,+ "sha256": "82b1d570030f4858683064d10a214be1ded4b1d93de190d8971ad0847ac5314e"},{"path": "mocap/prompthmr_publish.py",@@ -1839,6 +1839,11 @@"bytes": 2246,"sha256": "4184520af56fe2fb21c4866cf978dfd5d817132142fe9d419b02695adbd1d82b"},+ {+ "path": "mocap/resource_safety.py",+ "bytes": 2006,+ "sha256": "87d3e2dab8b8e66c88b4b9c33f6a80fb3b1fc63ccdbbe553c0ccd82b83e43fa5"+ },{"path": "mocap/result_artifacts.py","bytes": 5448,@@ -2116,8 +2121,8 @@},{"path": "mocap/workspace_ui.py",- "bytes": 37974,- "sha256": "12520e6c1d64f7d1744d47bc51b9dae2f839bcf28958105718a71d3e44cc219e"+ "bytes": 38463,+ "sha256": "cc5b4f7c0924f1ba4318cbc43a53f52b7cebf75da7425c85979ff997d1999da5"},{"path": "native_compat/LICENSE",diff --git a/docs/AGENT_GUIDE.md b/docs/AGENT_GUIDE.mdindex 61fcb8c..323f5cb 100644--- a/docs/AGENT_GUIDE.md+++ b/docs/AGENT_GUIDE.md@@ -176,7 +176,7 @@ Compiler tools and temporary build data are not installed runtime size.`mocap/prompthmr_camera.py` loads the two SHA-256 checked camera weights,invokes the pinned masked DroidCalib/Metric3D equations, uses Torch SDPA forMetric3D attention and one-image depth batches. Keep full temporal context and-the actual memory guards. Invalid tracking must fail, not silently switch modes.+the Resource Safety-controlled limits and actual OOM handling. Invalid tracking must fail, not silently switch modes.The camera module identity/weights are included only for moving inference.`prompthmr_publish.py` preserves the common world, derives each frame's incambody transform with the registered pelvis pivot, and commits the native camera@@ -190,8 +190,8 @@ MAMMA runs an optional complete multi-view pipeline using a separate pinnedPython 3.11 Windows runtime installed with Setup_MAMMA.cmd. The current appadapter accepts two or more synchronized fixed-camera views, with one commontrim and thumbnail preview switching. There is no fixed camera-count maximum;-retain existing RAM/Windows allocation-headroom monitoring, CUDA allocator-budgets and OOM failure handling. Do not replace the removed camera-count cap+retain Resource Safety control over RAM/Windows allocation-headroom stops and+CUDA allocator budgets, plus actual OOM failure handling in either setting. Do not replace the removed camera-count capwith another arbitrary count limit. See [MAMMA scope](MAMMA.md).VGGT-Omega plus GeoCalib is the automatic default; compatible manual calibration is optional.GeoCalib supplies background gravity before MAMMA 3D fitting, replacing the@@ -392,16 +392,31 @@ runtime dependency, source motion or contact change is part of export.## Resources and performance-Use **Resource Mode > Automatic** by default. It keeps the fast path when the current GPU budget is sufficient and selects supported Low Memory paths per operation when needed. A supported fast operation that raises CUDA OOM is released and retried once in Low Memory. ExMR Low Memory uses CPU-first body/hand loading and converts Sapiens' existing FP16 layers before GPU transfer; ExMR body/hand batches stay 8. FlowHMR offloads SAM/VGGT blocks; MAMMA offloads VGGT camera blocks while retaining its pinned masks/landmark/fitting settings. GVHMR/add-ons retain adaptive image batches and full-context attention. The saved Automatic selection is not changed. Resource decisions and memory advice appear in the app Console and CMD. Model precision, frame count, resolution and iterations are not reduced. CPU loading/offloading can be slower and use more RAM; it is not a promise every clip will fit. Estimates select a path, never reject a job. The desktop still checks actual RAM and Windows allocation headroom every 0.5 seconds and stops workers when these become low. Preserve completed stages, genuine model limits and original motion. Do not rerun inference for operations that can use existing results.+**Resource Safety** defaults on below Resource Mode. Off skips the measured+RAM/commit-headroom stop and sets the PyTorch allocator fraction to 1 (no app+VRAM cap). Keep adaptive batch/path selection, actual OOM backoff/recovery,+the independent stall check, cancellation and generation protection in both+settings. Do not describe this option as disabling every memory check or as a+guarantee that a workload fits. See [behavior and thresholds](PERFORMANCE.md#resource-safety).++It is an installation preference in ignored `config/local.json`, not a project+or inference option. Preserve other local settings when writing it. GUI jobs+snapshot the preference and pass `RGB_MOCAP_RESOURCE_SAFETY=1` or `0` into all+worker runtimes, including isolated launches; only explicit `0` disables it.+PEAR workers inherit the same preference. Never remove actual OOM handling or+change model equations/precision when extending this control. Model result+identity must not include this local checkbox value.++Use **Resource Mode > Automatic** by default. It keeps the fast path when the current GPU budget is sufficient and selects supported Low Memory paths per operation when needed. A supported fast operation that raises CUDA OOM is released and retried once in Low Memory. ExMR Low Memory uses CPU-first body/hand loading and converts Sapiens' existing FP16 layers before GPU transfer; ExMR body/hand batches stay 8. FlowHMR offloads SAM/VGGT blocks; MAMMA offloads VGGT camera blocks while retaining its pinned masks/landmark/fitting settings. GVHMR/add-ons retain adaptive image batches and full-context attention. The saved Automatic selection is not changed. Resource decisions and memory advice appear in the app Console and CMD. Model precision, frame count, resolution and iterations are not reduced. CPU loading/offloading can be slower and use more RAM; it is not a promise every clip will fit. Estimates select a path, never reject a job. With Resource Safety enabled, the desktop checks actual RAM and Windows allocation headroom every 0.5 seconds and stops workers when these become low. Preserve completed stages, genuine model limits and original motion. Do not rerun inference for operations that can use existing results.PromptHMR retains the same one-image batch/full temporal context in Automaticand Low Memory; extra block offloading is not implemented. Do not promise amode-dependent VRAM saving or an unsupported offload retry for this path. Actual-memory guards still apply. Its 422-frame/two-person run took 236.2 s, with peak+allocation failures are still reported; proactive limits follow Resource Safety. Its 422-frame/two-person run took 236.2 s, with peakallocated VRAM 4.61 GiB (7.83 GiB reserved) and worker working set 8.74 GiB; see[scope and stage times](models/PROMPTHMR.md#recorded-validation).-GPU allocator limits share ComfyUI's external-use margin: 600 MiB on Windows, 700 MiB above 15 GiB GPU capacity (400 MiB on other systems). Subtract it from actual free VRAM without an additional percentage cap or fixed FlowHMR/ExMR 3/2 GiB reserve. This margin is separate from inference working space. Keep offloading in the app's validated `memory_mode.py` / `gpu_offload.py` adapters, without importing ComfyUI or changing model precision. Offload is inference-only, synchronous and unpinned; close hooks/models on success and failure. Actual RAM pressure remains a stop condition because offloading can increase host memory.+With Resource Safety enabled, GPU allocator limits share ComfyUI's external-use margin: 600 MiB on Windows, 700 MiB above 15 GiB GPU capacity (400 MiB on other systems). Subtract it from actual free VRAM without an additional percentage cap or fixed FlowHMR/ExMR 3/2 GiB reserve. This margin is separate from inference working space. Keep offloading in the app's validated `memory_mode.py` / `gpu_offload.py` adapters, without importing ComfyUI or changing model precision. Offload is inference-only, synchronous and unpinned; close hooks/models on success and failure. Actual RAM pressure remains a stop condition when Resource Safety is enabled because offloading can increase host memory.### Measured savings and acceleration@@ -534,7 +549,7 @@ Keep its size/hash-checked Model Manager download/import and trusted loader.Do not replace the shared YOLOv8x asset used by offline models. Detector boxescan alter pose predictions; detection success is not an accuracy measurement.Idle acknowledgement keeps a deliberately waiting started worker from appearing-stalled. Keep RAM/VRAM monitoring and bounded mailboxes while it is running.+stalled. Keep Resource Safety-controlled RAM/VRAM limits and bounded mailboxes while it is running.Selecting a webcam may create the separate `pear_camera_preview` capture worker.It imports OpenCV/NumPy, not PEAR or Torch, and uses bounded latest-frame buffersdiff --git a/docs/MAMMA.md b/docs/MAMMA.mdindex 5fd45c3..c4706ae 100644--- a/docs/MAMMA.md+++ b/docs/MAMMA.md@@ -9,9 +9,10 @@ example is not a general model limit.**RGB MoCap implementation:** reconstruction accepts two or more synchronizedfixed-camera videos without a fixed camera-count maximum. Available RAM and-VRAM determine practical capacity. Existing system-memory monitoring, CUDA-allocator budgeting and OOM failure handling remain active; removing the input-count limit does not guarantee that every camera/clip combination fits memory.+VRAM determine practical capacity. Resource Safety controls system-memory+stopping and CUDA allocator budgeting; actual OOM handling remains active.+Removing the input count limit does not guarantee that every camera/clip+combination fits memory.Four columns in the thumbnail strip are only a layout choice; more views addrows. Input/preparation/save/restore was checked with up to 65 tiny syntheticcamera files, not 65-view AI fitting. Full model inference has only the scope@@ -205,8 +206,9 @@ Automatic fallback retain copy loading because the experimental assign/offloadcombination increased Windows private allocation. See the[camera-loading measurements and scope](PERFORMANCE.md#vggt-camera-checkpoint-loading).Offloading may be slower and use more RAM; masks, landmarks and fitting retain-their existing bounded settings. The shared allocator budget and system-memory guard-still apply; shorten the common clip or reduce input views yourself if needed.+their existing bounded settings. The shared allocator budget and system-memory+stop follow [Resource Safety](PERFORMANCE.md#resource-safety), default on.+Shorten the common clip or reduce input views yourself if needed.## Applied acceleration and resource modesdiff --git a/docs/PERFORMANCE.md b/docs/PERFORMANCE.mdindex 38d3550..04a7615 100644--- a/docs/PERFORMANCE.md+++ b/docs/PERFORMANCE.md@@ -18,10 +18,38 @@ views and fitting iterations. Existing native mixed precision remains in use;this is not a claim that every model layer is FP32.**Low Memory is primarily a VRAM-saving mode, not a system-RAM-saving mode.**-Actual RAM and Windows allocation headroom are monitored in both modes. Work-stops with an error when memory becomes insufficient; close other applications-or shorten the clip if necessary. Decisions and memory advice appear in both-the app Console and CMD window.+With **Resource Safety** enabled (the default), actual RAM and Windows allocation+headroom are monitored in both modes. Work stops with an error when the measured+headroom becomes low. Decisions and memory advice appear in both the app Console+and CMD window. See the independent safety control below.++### Resource Safety++The **Resource Safety** checkbox sits below Resource Mode and defaults **on**.++- **On:** retain the existing low-RAM/Windows commit-headroom stop and PyTorch+ VRAM allocation budget. RAM reserve stays 1–4 GiB according to system size;+ Windows commit headroom below 1 GiB also triggers the monitor. Ordinary low+ samples must repeat; critical headroom below 256 MiB stops immediately.+ The desktop checks every 0.5 seconds. The VRAM budget subtracts the existing+ 600 MiB Windows external-use margin, or 700 MiB for GPUs over 15 GiB, from+ currently free VRAM. These thresholds have not been increased.+- **Off:** skip that RAM/commit stop and remove the app's PyTorch allocator cap.+ This does not create additional memory. Actual allocation failures or system+ slowdowns can still occur; other applications and non-PyTorch allocations are+ outside the allocator cap in either setting.++In both settings, Automatic still measures resources to select batches and+supported Low Memory paths. Actual CUDA OOM backoff/recovery, model limits,+cancellation, incomplete-result protection and the separate 180-second+no-output/no-CPU stall check remain. Disabling safety does not change inference+precision or intentionally force larger batches. It is not a model speed preset.++The preference is local to this installation, saved in ignored+`config/local.json`, independently of projects and model selections. Console+and CMD show the setting for queued work. Changing it does not rerun inference;+running jobs retain their starting setting. PEAR inherits the same preference+for its live and alignment workers; its offline resource controls remain hidden.### What changes for each model@@ -35,8 +63,8 @@ the app Console and CMD window.PEAR is a separate live tool: the offline Resource Mode control is hidden. Itsfixed-length bone path uses FP16 encoding/FP32 decoding, one requested frame per-prediction and bounded latest-frame presentation. It retains RAM monitoring and-a CUDA allocation budget but has no automatic offload/retry path. See the+prediction and bounded latest-frame presentation. Its RAM monitor and CUDA+allocation budget follow Resource Safety; it has no automatic offload/retry path. See the[PEAR timings and limitations](models/PEAR.md#placement-and-performance).## Measured memory savingsdiff --git a/docs/USER_GUIDE.md b/docs/USER_GUIDE.mdindex d9e4697..c01efbc 100644--- a/docs/USER_GUIDE.md+++ b/docs/USER_GUIDE.md@@ -508,6 +508,7 @@ selected result is missing, reconstruct it; the app reports it as unavailable.| **MAMMA → Reference Height (m)** | Numeric approximate standing height, default 1.70 m. Sets VGGT scene scale, not every actor's height; unused with metric manual calibration. || **PromptHMR → Camera / People / Interaction Prompt** | People defaults to 2; 0 detects automatically up to eight. Interaction Prompt defaults on; off follows the official default video path. Fixed Camera is the default; optional Moving Camera uses DroidCalib + Metric3D after camera setup and two additional model downloads. No animated fingers. These settings apply on Reconstruct 3D. See the [PromptHMR guide](models/PROMPTHMR.md). || **Resource Mode** | Automatic uses the fast path when GPU memory is sufficient and selects supported Low Memory paths when needed. Low Memory uses CPU loading/offloading and existing bounded image processing; it can be slower and use more RAM. The selection and reason appear in Console and the CMD window. |+| **Resource Safety** | Default on, directly below Resource Mode. On retains low-RAM/Windows headroom stopping and the PyTorch VRAM allocation limit. Off bypasses those limits; Automatic batching, Low Memory selection and actual allocation-error recovery remain. Saved locally, independently of projects. See [details](PERFORMANCE.md#resource-safety). || **Prepare Preview** | Rebuild mesh/skeleton previews from existing motion without running the AI model again. Useful for older projects. || **Cancel Job** | Stop queued processing; completed results are kept. |@@ -523,9 +524,11 @@ maximum. PromptHMR accepts one fixed- or moving-camera video, 4–1,800 workingguarantee that a workload fits RAM or VRAM.Processing is allowed to start without a predicted RAM/VRAM minimum. While it-runs, the app monitors actual available RAM and Windows allocation headroom.-If either becomes low, it stops the processing job and shows the available memory-in the error message. The app also reports actual CPU/GPU allocation failures.+runs with Resource Safety enabled, the app monitors actual available RAM and+Windows allocation headroom. If either becomes low, it stops the processing job+and shows the available memory in the error message. Disabling Resource Safety+bypasses this stop and the PyTorch VRAM cap; it does not disable actual+allocation-error reporting or the supported OOM retry paths. The app also reports actual CPU/GPU allocation failures.Completed stages are retained for retry. ExMR Low Memory prepares Sapiens' existingFP16 layers on CPU and loads body/hand weights on CPU before GPU transfer; itsbody/hand feature batches remain 8. FlowHMR Low Memory offloads SAM and VGGT@@ -550,7 +553,7 @@ component has a controlled offload comparison. See [conditions, times and componThese are observations, not minimum requirements. The newest CPU prefetch isdisabled in Low Memory; FlowHMR SAM also uses one-frame batches in that mode.-GPU allocator budgets use ComfyUI's external-use margin: 600 MiB on Windows,+With Resource Safety enabled, GPU allocator budgets use ComfyUI's external-use margin: 600 MiB on Windows,or 700 MiB on GPUs larger than 15 GiB, subtracted from currently free VRAM.The five offline model paths use this rule; FlowHMR/ExMR no longer subtract fixed3/2 GiB or impose an additional 95/90% ceiling. Inference working memory isdiff --git a/docs/VALIDATION.md b/docs/VALIDATION.mdindex 90c5422..7a06a4f 100644--- a/docs/VALIDATION.md+++ b/docs/VALIDATION.md@@ -1,5 +1,42 @@# Source package validation+## Resource Safety control (2026-11-03)++The default-on checkbox below Resource Mode controls the existing desktop+low-RAM/Windows commit-headroom stop and the PyTorch VRAM allocator cap. Off+retains adaptive batching/path selection, supported actual-OOM recovery,+cancellation, generation protection and the independent no-output/no-CPU stall+check. No runtime dependencies, model equations or precision were changed.++Six private policy tests covered default and corrupt preferences, preserving+unrelated local settings, unchanged enabled thresholds/routing, disabled RAM+queries, low/critical memory, injected OOM exception backoff, PID identity and+stall handling. Offscreen GUI checks covered default-on layout, visible+unchecked state, persistence after reopening, six model selections, disabled+controls during work and both flag values reaching isolated workers and their+desktop guards. PEAR session checks covered inherited flags and process closure.+These are control/lifecycle checks, not playback throughput measurements.++A small real CUDA allocation probe passed in the installed shared, FlowHMR,+ExMR, MAMMA and PromptHMR profiles: a synthetic 4 MiB allocator allowance+rejected a 16 MiB allocation with safety on; safety off allowed it. This did not+exhaust physical RAM/VRAM. Both installed Torch 2.7.1 and 2.8.0 builds were used.+An actual legacy fixed-camera PromptHMR receipt remained reusable without new+video preparation or inference after the logging-only pipeline change.++A subsequent manual ExMR run completed with Resource Safety off and Automatic+fast paths: 2,586 working frames at 30 fps (about 86.2 seconds), total 299.22+seconds including tracking, correction and preview/export preparation. No OOM,+Low Memory fallback or safety stop appeared in that log. The keypoint receipt+recorded 5.68 GiB peak allocated VRAM; a whole-run peak RAM measurement was not+recorded. This is not a paired on/off performance or output-accuracy benchmark.+FlowHMR in the same log reused cached results, so its time is not comparable.++Checks used the existing Windows test PC. No clean-Windows or other-GPU test+was performed, and disabling safety does not guarantee success under real+memory exhaustion. Test inputs, scripts, logs and local preferences stay+outside the public source package. See [behavior and thresholds](PERFORMANCE.md#resource-safety).+## PromptHMR shared download cache (2026-11-02)Torch Hub/Hugging Face download locations now belong to the app's shareddiff --git a/docs/models/EXMR.md b/docs/models/EXMR.mdindex 9ebe7e5..b907dc5 100644--- a/docs/models/EXMR.md+++ b/docs/models/EXMR.md@@ -99,8 +99,8 @@ poses or fingers. Automatic contact detection can also miss intentional support;edit its timings rather than expecting correction to recover missing evidence.Contact correction is distinct from Smooth Motion and preserves original results.-RAM/Windows allocation-headroom monitoring and the shared CUDA allocator budget-remain active. Allocation failure stops the job with an error; shorten footage+RAM/Windows allocation-headroom stopping and the shared CUDA allocator budget+follow [Resource Safety](../PERFORMANCE.md#resource-safety), default on. Allocation failure stops the job with an error; shorten footageor free resources if necessary. Historical [processing/VRAM measurements](../USER_GUIDE.md#recorded-processing-time-and-vram)are individual runs, not minimum specifications. See [validation](../VALIDATION.md)for the tested PC and scope, and [licenses](../../THIRD_PARTY_NOTICES.md) fordiff --git a/docs/models/FLOWHMR.md b/docs/models/FLOWHMR.mdindex 7ebf745..8d17905 100644--- a/docs/models/FLOWHMR.md+++ b/docs/models/FLOWHMR.md@@ -142,8 +142,8 @@ or finger errors. A fixed-camera option cannot compensate for a camera thatactually moves. Contact correction reduces supported-foot/palm sliding but doesnot repair bad camera geometry or identity swaps.-The app retains RAM/Windows allocation-headroom monitoring, CUDA allocator-budgets and allocation-error reporting. Camera analysis and long motion context+The app retains allocation-error reporting. RAM/Windows allocation-headroom+stopping and CUDA allocator budgets follow [Resource Safety](../PERFORMANCE.md#resource-safety), default on. Camera analysis and long motion contextcan still exceed available memory. Historical [time/VRAM records](../USER_GUIDE.md#recorded-processing-time-and-vram)include camera estimation and predate Fast SAM; they are not predictions orminimum specifications. See [validation](../VALIDATION.md) anddiff --git a/docs/models/GVHMR.md b/docs/models/GVHMR.mdindex c08c4c3..914ad9c 100644--- a/docs/models/GVHMR.md+++ b/docs/models/GVHMR.md@@ -70,8 +70,9 @@ FootMR does not guarantee ground contact; use Motion Correction for that.HandFlow can still make finger mistakes, and neither add-on fixes a wrong personor an unobserved pose. Correction retains original motion for comparison.-RAM/Windows allocation-headroom monitoring, adaptive supported GPU work and-allocation-error reporting stay active. Automatic keeps the fast path when GPU+RAM/Windows allocation-headroom stopping and CUDA allocator limits follow+[Resource Safety](../PERFORMANCE.md#resource-safety), default on. Adaptive supported+GPU work and actual allocation-error reporting stay active in either setting. Automatic keeps the fast path when GPUmemory is sufficient and selects existing Low Memory image processing whenneeded. Full temporal context is preserved; dense attention remains enabledwhen it fits. Resource decisions and memory advice appear in Console and CMD.diff --git a/docs/models/PEAR.md b/docs/models/PEAR.mdindex aa988b9..db3f3a7 100644--- a/docs/models/PEAR.md+++ b/docs/models/PEAR.md@@ -246,8 +246,9 @@ keeps video decoding, camera capture, calibration and inference off the GUI thremailboxes and no automatic video/pose recording. Available RAM and CUDA allocationfailures are reported rather than repeatedly retrying a failing worker.The offline Resource Mode selector does not apply to PEAR. Its live worker uses-the validated fast configuration with available-memory monitoring and CUDA-allocation limits; it has no block-offload or automatic Low Memory retry.+the validated fast configuration. Available-memory stopping and CUDA allocation+limits follow the local [Resource Safety](../PERFORMANCE.md#resource-safety)+preference selected in an offline model; it has no block-offload or automatic Low Memory retry.## Files and developmentdiff --git a/docs/models/PROMPTHMR.md b/docs/models/PROMPTHMR.mdindex 0b5586e..e5f6f4e 100644--- a/docs/models/PROMPTHMR.md+++ b/docs/models/PROMPTHMR.md@@ -178,7 +178,7 @@ Windows adaptations retain the SLAM equations and full frame sequence, use64-bit tensor indices, avoid CPU/CUDA kernel-name collisions, and use nativeTorch SDPA for Metric3D attention. Depth batches are one image in both resourcemodes; the keyframe buffer covers the selected clip plus trajectory-fill slots.-The existing memory/OOM guards remain active; long trims can need much more+RAM/VRAM limits follow [Resource Safety](../PERFORMANCE.md#resource-safety); actual OOM handling remains active; long trims can need much morememory. Additional PromptHMR block offloading is not implemented.Camera setup logs: `.setup/logs/prompthmr-camera-*.log`.@@ -216,9 +216,9 @@ not displayed as stationary poses or replaced with another actor.Both Automatic and Low Memory keep the validated **one-image batch**, modelprecision, full temporal context and native post-optimization. Additional-PromptHMR block offloading is not implemented. Actual RAM/Windows allocation-headroom monitoring, CUDA allocator budgets and allocation-error reporting remain-active. Low Memory is not a promise of a smaller PromptHMR footprint; trim or+PromptHMR block offloading is not implemented. RAM/Windows headroom stopping+and CUDA allocator budgets follow [Resource Safety](../PERFORMANCE.md#resource-safety),+default on. Actual allocation-error handling remains active in either setting. Low Memory is not a promise of a smaller PromptHMR footprint; trim orclose other GPU applications when needed.Windows adapters retain strict checkpoint loading, avoid discarded initializationdiff --git a/docs/models/README.md b/docs/models/README.mdindex 0884f26..dc957d2 100644--- a/docs/models/README.md+++ b/docs/models/README.md@@ -67,9 +67,10 @@ correction and display-only viewport controls. Original and corrected resultsare preserved. One project can hold separate results for each model. MAMMA savesall of its camera videos with **Save Project As**.-Use **Resource Mode > Automatic** initially. Actual RAM/Windows allocation-headroom monitoring, CUDA allocator budgets and allocation-error reporting remain-active. More frames, pixels, people or views can increase work; no setting+Use **Resource Mode > Automatic** initially. **Resource Safety**, default on,+controls low-RAM/Windows headroom stopping and CUDA allocator limits. Off bypasses+these limits; adaptive batching and actual allocation-error handling stay active.+See [Resource Safety](../PERFORMANCE.md#resource-safety). More frames, pixels, people or views can increase work; no settingguarantees that every clip fits. Automatic selects supported Low Memory pathswhen the GPU budget is low; a supported operation can recover once after CUDAOOM. Low Memory uses CPU loading/offloading and existing bounded image batches,diff --git a/mocap/compute_policy.py b/mocap/compute_policy.pyindex 1b46988..13cb9a7 100644--- a/mocap/compute_policy.py+++ b/mocap/compute_policy.py@@ -21,6 +21,8 @@ def gpu_memory_fraction(free,total):Model weights, activations and temporary inference buffers share this budget.It does not cap non-PyTorch allocations or reserve memory against other apps."""+ from .resource_safety import enabled+ if not enabled():return 1.return max(0.,min(1.,(free-gpu_reserve(total))/total))diff --git a/mocap/gui.py b/mocap/gui.pyindex 7009489..7148006 100644--- a/mocap/gui.py+++ b/mocap/gui.py@@ -449,6 +449,7 @@ class MainWindow(PreviewExportWorkspace,PearWorkspace,PromptHMRWorkspace,MammaWoself.update_people_readiness()tool = MOTION_TOOLS[self.model_choice.currentData()]self.compute_mode.setEnabled(not self.busy)+ self.resource_safety.setEnabled(not self.busy)stages = tool.stages(self.htd_refine.isChecked(), self.footmr_refine.isChecked(), handflow=self.handflow_refine.isChecked())from .models import STAGE_REQUIREMENTS, BY_KEYrequired = {key for stage in stages for key in STAGE_REQUIREMENTS.get(stage, ())}@@ -1172,10 +1173,22 @@ class MainWindow(PreviewExportWorkspace,PearWorkspace,PromptHMRWorkspace,MammaWoif self.project is not None and not self.busy:self.prepare_target_preview()+ def resource_safety_changed(self,value):+ from .resource_safety import ENV,save,message+ try:save(value)+ except (OSError,ValueError) as error:+ self.resource_safety.blockSignals(True);self.resource_safety.setChecked(not value);self.resource_safety.blockSignals(False)+ self.log.append('Cannot save Resource Safety: '+str(error));return+ os.environ[ENV]='1' if value else '0'+ self.log.append(message(value))+def start_jobs(self, jobs, refresh_characters=False):if self.busy:returnjobs=list(jobs)+ from .resource_safety import message+ self._job_resource_safety=self.resource_safety.isChecked()+ self.log.append(message(self._job_resource_safety))self.character_refresh_queue=[]if refresh_characters:try:@@ -1360,6 +1373,7 @@ class MainWindow(PreviewExportWorkspace,PearWorkspace,PromptHMRWorkspace,MammaWoenvironment.insert("PYTHONIOENCODING", "utf-8")environment.insert("PYTHONUNBUFFERED", "1")environment.insert("RGB_MOCAP_COMPUTE_MODE", self.compute_mode.currentData())+ environment.insert('RGB_MOCAP_RESOURCE_SAFETY','1' if self._job_resource_safety else '0')environment.insert('RGB_MOCAP_FLOW_INTERVAL',str(self.flow_sampling.currentData()))environment.insert('RGB_MOCAP_FLOW_FAST_SAM','1' if self.fast_sam.isChecked() else '0')environment.insert('RGB_MOCAP_FLOW_BATCH4','1' if self.flow_batch4.isChecked() else '0')@@ -1376,7 +1390,7 @@ class MainWindow(PreviewExportWorkspace,PearWorkspace,PromptHMRWorkspace,MammaWodef start_processing_guard(self):from .processing_guard import ProcessingGuardtry:- self.processing_guard = ProcessingGuard(self.process.processId())+ self.processing_guard = ProcessingGuard(self.process.processId(),resource_safety=self._job_resource_safety)self.guard_timer.start()except Exception as error:self.log.append('Resource monitor unavailable: ' + str(error))diff --git a/mocap/model_guide.py b/mocap/model_guide.pyindex 141499c..d1c3d00 100644--- a/mocap/model_guide.py+++ b/mocap/model_guide.py@@ -52,6 +52,7 @@ th { text-align:left; background-color:#333333; } td, th { padding:7px; }<p>These are subjective observations from our test videos, not a universal ranking or accuracy benchmark.Try another model if a particular movement looks wrong.</p>""" + descriptions + """<p>Offline source motion: File > Export offers FBX, BVH and portable Blender projects with video/cameras. MAMMA also offers a whole-scene Blender bundle with checked body meshes and all cameras. Keep exported video/mesh folders together. No additional inference is run for export.</p>+<p><b>Resource Safety</b> defaults on below Resource Mode. On retains low-RAM stopping and the PyTorch VRAM allocation limit. Off bypasses these limits; Automatic batching, supported Low Memory paths and actual allocation-error handling remain. The preference is saved locally, separately from projects. PEAR inherits it while its offline resource controls are hidden. See docs/PERFORMANCE.md for details.</p><h3>Recorded processing time and memory</h3><table width="98%" border="0" cellspacing="1" cellpadding="7"><tr><th>Model</th><th>Input</th><th>Processing time</th><th>Peak VRAM (GiB)</th><th>Peak RAM (GiB)</th></tr>""" + rows + """</table>diff --git a/mocap/pear/align_worker.py b/mocap/pear/align_worker.pyindex 3303e8b..cbb356c 100644--- a/mocap/pear/align_worker.py+++ b/mocap/pear/align_worker.py@@ -28,7 +28,7 @@ def align(path,progress):from vggt_omega.utils.pose_enc import encoding_to_camerafrom ..gpu_offload import load_vggt,releasefrom geocalib import GeoCalib- from ..compute_policy import gpu_reserve+ from ..compute_policy import gpu_memory_fractiontorch.set_num_threads(4);cv2.setNumThreads(2)folder=owned_folder(path);job=json.loads((folder/'job.json').read_text('utf8'));n=int(job['count'])if not 1<=n<=32 or len(job['images'])!=2*n:raise ValueError('Invalid camera alignment job')@@ -60,7 +60,7 @@ def align(path,progress):# its rig-to-depth scale fit; floor/gravity still exclude the person.paths.append(image_path if n==1 else p);images.append(im);masks.append(mask)start=time.perf_counter();free,total=torch.cuda.mem_get_info()- torch.cuda.set_per_process_memory_fraction(max(.001,min(1.,(free-gpu_reserve(total))/total)))+ torch.cuda.set_per_process_memory_fraction(max(.001,gpu_memory_fraction(free,total)))stages=[];progress('Camera Align · Loading VGGT camera/depth model…')torch.cuda.reset_peak_memory_stats();t=time.perf_counter();model=load_vggt(BY_KEY['flow_vggt'].path,'cuda',camera_only=False)progress('Camera Align · VGGT background cameras and depth…')diff --git a/mocap/pear/worker.py b/mocap/pear/worker.pyindex fe02b1f..abf515b 100644--- a/mocap/pear/worker.py+++ b/mocap/pear/worker.py@@ -38,10 +38,9 @@ def main():from .temporal_filter import ParameterFilterfrom .input_transform import rotate_frame,input_rotationsif not torch.cuda.is_available():raise RuntimeError('PEAR requires a compatible NVIDIA GPU.')- from ..compute_policy import gpu_reserve+ from ..compute_policy import gpu_memory_fractionfree,total=torch.cuda.mem_get_info()- budget=max(1024**2,free-gpu_reserve(total))- torch.cuda.set_per_process_memory_fraction(min(1.,budget/total))+ torch.cuda.set_per_process_memory_fraction(max(1024**2/total,gpu_memory_fraction(free,total)))model=Pear(mesh=False,fixed_rig=True,profile='fast',progress=lambda text:send(pipe,{'type':'status','text':text}))send(pipe,{'type':'status','text':'Warming up live inference…'})model.run(np.zeros((480,640,3),dtype=np.uint8),box_override=np.array([160,10,480,470],dtype=np.float32))diff --git a/mocap/processing_guard.py b/mocap/processing_guard.pyindex af6488d..c17b670 100644--- a/mocap/processing_guard.py+++ b/mocap/processing_guard.py@@ -20,8 +20,10 @@ def commit_headroom():class ProcessingGuard:- def __init__(self,pid,now=None):+ def __init__(self,pid,now=None,resource_safety=None):import psutil+ from .resource_safety import enabled+ self.resource_safety=enabled() if resource_safety is None else bool(resource_safety)self.process=psutil.Process(pid)self.created=self.process.create_time()self.last_output=self.last_cpu_change=time.monotonic() if now is None else now@@ -50,12 +52,13 @@ class ProcessingGuard:self.activity_cpu=self.cpuexcept psutil.NoSuchProcess:return Noneexcept psutil.AccessDenied:pass- memory=psutil.virtual_memory();commit=commit_headroom()- message=memory_pressure_message(memory.available,memory.total,commit)- low=message is not None- self.low_samples=self.low_samples+1 if low else 0- critical=memory.available<256*1024**2 or (commit is not None and commit<256*1024**2)- if self.low_samples>=2 or critical:return message+ if self.resource_safety:+ memory=psutil.virtual_memory();commit=commit_headroom()+ message=memory_pressure_message(memory.available,memory.total,commit)+ low=message is not None+ self.low_samples=self.low_samples+1 if low else 0+ critical=memory.available<256*1024**2 or (commit is not None and commit<256*1024**2)+ if self.low_samples>=2 or critical:return messageif idle_timeout(self.last_output,self.last_cpu_change,now):return 'Processing stopped after 180 seconds without output or CPU activity. The app is still available; retry or use a shorter clip.'return Nonediff --git a/mocap/prompthmr_cache.py b/mocap/prompthmr_cache.pyindex b443116..b743c79 100644--- a/mocap/prompthmr_cache.py+++ b/mocap/prompthmr_cache.py@@ -21,6 +21,9 @@ PIPELINE_CACHE_ONLY = {'b3098bbc038f9f5e25c9b9e96c9ec4fa2116226f74c645089bd328014f024e7d','d1075279956f9443c3ff80694a9388fc9e1f2d74b3af5f9dab0714c50c2a7687':'b3098bbc038f9f5e25c9b9e96c9ec4fa2116226f74c645089bd328014f024e7d',+ # Resource Safety wording only; no fixed-camera inference changes.+ '82b1d570030f4858683064d10a214be1ded4b1d93de190d8971ad0847ac5314e':+ 'b3098bbc038f9f5e25c9b9e96c9ec4fa2116226f74c645089bd328014f024e7d',}diff --git a/mocap/prompthmr_pipeline.py b/mocap/prompthmr_pipeline.pyindex 80affc9..6a09a46 100644--- a/mocap/prompthmr_pipeline.py+++ b/mocap/prompthmr_pipeline.py@@ -143,7 +143,7 @@ def inference(stage,job,engine):work=work_for(job);link_assets(engine)torch.set_num_threads(4);torch.manual_seed(0)free,total=torch.cuda.mem_get_info();torch.cuda.set_per_process_memory_fraction(gpu_memory_fraction(free,total))- announce(stage,requested_mode(),'PromptHMR keeps the validated one-image batch and full temporal context in both modes. Additional block offloading is not implemented; actual RAM/VRAM guards remain active.',emit)+ announce(stage,requested_mode(),'PromptHMR keeps the validated one-image batch and full temporal context in both modes. Additional block offloading is not implemented; Resource Safety controls the RAM/VRAM stop limits.',emit)os.chdir(engine);sys.path.insert(0,str(engine))from .prompthmr_cache import configure_downloadsconfigure_downloads(work)diff --git a/mocap/resource_safety.py b/mocap/resource_safety.pynew file mode 100644index 0000000..1f79f85--- /dev/null+++ b/mocap/resource_safety.py@@ -0,0 +1,53 @@+"""Local execution preference, independent of motion/project identities."""+import json+import os+from pathlib import Path++ENV = 'RGB_MOCAP_RESOURCE_SAFETY'+MAX_BYTES = 64 * 1024+HELP = ('Stop when RAM headroom is low and limit VRAM allocation. Disable to bypass '+ 'these limits; actual memory shortages may cause processing failure or system '+ 'slowdowns. Automatic batching, Low Memory and OOM recovery remain enabled.')+++def enabled():+ # Only an explicit opt-out disables protection, including isolated workers.+ return os.environ.get(ENV) != '0'+++def path(root=None):+ if root is None:+ from .paths import HOME+ root = HOME+ return Path(root) / 'config/local.json'+++def read_settings(target):+ if not target.exists():return {}+ if target.stat().st_size > MAX_BYTES:raise ValueError('Local settings exceed the size limit.')+ value = json.loads(target.read_text(encoding='utf-8'))+ if not isinstance(value, dict):raise ValueError('Invalid local settings.')+ return value+++def load(root=None):+ try:+ value = read_settings(path(root)).get('resource_safety', True)+ return value if isinstance(value, bool) else True+ except (OSError, ValueError):return True+++def save(value, root=None):+ if not isinstance(value, bool):raise ValueError('Invalid Resource Safety selection.')+ from .storage import atomic_json+ target = path(root);settings = read_settings(target)+ settings['resource_safety'] = value+ if len(json.dumps(settings, ensure_ascii=False, indent=2).encode('utf-8')) > MAX_BYTES:+ raise ValueError('Local settings exceed the size limit.')+ atomic_json(target, settings)+++def message(value):+ return ('Resource Safety: ON. RAM headroom stopping and VRAM allocation limits are enabled.' if value else+ 'Resource Safety: OFF. RAM headroom stopping and VRAM allocation limits are disabled. '+ 'Automatic batching, Low Memory and actual OOM recovery remain enabled.')diff --git a/mocap/workspace_ui.py b/mocap/workspace_ui.pyindex a45f99c..6a2487a 100644--- a/mocap/workspace_ui.py+++ b/mocap/workspace_ui.py@@ -515,6 +515,14 @@ def build_workspace(w):w.compute_mode.addItem("Low Memory", "low_memory")w.compute_mode.setToolTip(tooltip_text("Automatic uses the fast path when memory is available and switches supported stages to Low Memory when needed. Low Memory uses CPU loading and offloading; it can be slower and use more RAM. Model precision and video frames are unchanged."))processing.addWidget(w.compute_mode)+ from .resource_safety import ENV,HELP,load+ import os+ w.resource_safety=QCheckBox('Resource Safety')+ w.resource_safety.setChecked(load())+ os.environ[ENV]='1' if w.resource_safety.isChecked() else '0'+ w.resource_safety.setToolTip(tooltip_text(HELP))+ w.resource_safety.toggled.connect(w.resource_safety_changed)+ processing.addWidget(w.resource_safety)resource_description=TooltipHelp('',w.compute_mode)resource_description.setObjectName('muted');resource_description.setWordWrap(True);processing.addWidget(resource_description)setup = group("GVHMR Models", settings)@@ -571,6 +579,8 @@ def build_workspace(w):w.task_info.setToolTip(tooltip_text('Step left estimates time for the current step; Total left estimates the remaining queue. Estimates appear once enough timing data is available and may change.'))footer.addWidget(w.task_info)w.log = ConsoleLog()+ from .resource_safety import message+ w.log.append(message(w.resource_safety.isChecked()))w.log.setReadOnly(True)w.log.setUndoRedoEnabled(False)w.log.document().setMaximumBlockCount(500)