Skip to content

Native Windows video motion capture with ExMR, FlowHMR and GVHMR, contact correction, humanoid retargeting, and FBX/VMD export.

Python

Fix recursive FlowHMR model download progress callbacks

toyxyz96e9ed24a363
diff --git a/SOURCE_MANIFEST.json b/SOURCE_MANIFEST.json
index f2c27ab..560927b 100644
--- a/SOURCE_MANIFEST.json
+++ b/SOURCE_MANIFEST.json
@@ -131,8 +131,8 @@
},
{
"path": "docs/VALIDATION.md",
- "bytes": 143635,
- "sha256": "77691e896537ccd67ee14e967685b97c109c2734e61db51d3e7e5eb1d005897e"
+ "bytes": 144966,
+ "sha256": "fc430e80094d020c483ebc24e42af44d31b9540d5a9a2d734ff62f93e24400ce"
},
{
"path": "docs/images/exmr-interaction-contact.png",
@@ -1476,8 +1476,8 @@
},
{
"path": "mocap/mamma_pipeline.py",
- "bytes": 19048,
- "sha256": "5c90318cfc520bfad4f84d0239a47bdc38b95be14f2f3fc79baf9d9c7e9f32ba"
+ "bytes": 19241,
+ "sha256": "8252ef60d906f1c36a8d3b832fbdf9da8204bedf66d3adecb55de52580121413"
},
{
"path": "mocap/mamma_publish.py",
@@ -1856,8 +1856,8 @@
},
{
"path": "mocap/resource_cache.py",
- "bytes": 2246,
- "sha256": "4184520af56fe2fb21c4866cf978dfd5d817132142fe9d419b02695adbd1d82b"
+ "bytes": 2739,
+ "sha256": "57f1170b1e5a1d9c47fcb07ef443f138964fb109bdcd2178f6579e881e6cbee9"
},
{
"path": "mocap/resource_safety.py",
@@ -2141,8 +2141,8 @@
},
{
"path": "mocap/worker_progress.py",
- "bytes": 2836,
- "sha256": "e98a7df6d9396ee5d8ef9411b76cf899497f6c873955812b18b7439376da2e0d"
+ "bytes": 3210,
+ "sha256": "c3b12bed270ffea56272e750b234e06c6c49ce7eea980d0520dd0c8180c517aa"
},
{
"path": "mocap/workspace_ui.py",
diff --git a/docs/VALIDATION.md b/docs/VALIDATION.md
index aa14e5c..624155e 100644
--- a/docs/VALIDATION.md
+++ b/docs/VALIDATION.md
@@ -2192,3 +2192,24 @@ verified cached archives. Both native checks and readiness configurations passed
The real launcher dependency/pending guards, GUI runtime activation and app import
also passed without opening a GUI or running model inference. Prior support
generations and user models/projects were preserved.
+
+## FlowHMR model download callback repair (2026-11-06)
+
+Issue #25 was reproduced before the fix: the worker's one-argument download
+wrapper rejected FlowHMR's recursive metadata call with its explicit progress
+callback. The scoped replacement accepts the original optional callback and
+restores the downloader on success, failure or interruption. Model URLs,
+SHA-256 checks, weights, runtime packages and inference calculations are unchanged.
+
+15 regression checks passed using actual download workers and tiny files served
+over localhost HTTP. They cover metadata-before-checkpoint order, sequential
+Download All-style jobs, individual downloads, verified-file reuse, metadata and
+checkpoint hash failures, interrupted transfers and retries, callback forwarding,
+nesting, cleanup and non-download dispatch. Four additional cache checks passed:
+exact reviewed hashes preserve the previous MAMMA inference identity, later edits
+invalidate normally, the complete code identity remains unchanged, and actual
+MAMMA preparation reuses a committed pre-fix result without running processing.
+
+These are isolated fixture tests, not public-provider downloads, GUI click tests,
+new motion inference or a clean-Windows installation. No user model/project files
+were changed. Test scripts and outputs are kept outside the public source tree.
diff --git a/mocap/mamma_pipeline.py b/mocap/mamma_pipeline.py
index fee0442..342148a 100644
--- a/mocap/mamma_pipeline.py
+++ b/mocap/mamma_pipeline.py
@@ -105,7 +105,9 @@ def prepare(path, job):
# All connector code contributes, not just the model prediction script.
from .paths import ROOT
from .storage import sha256
- identity['code']={name:sha256(ROOT/'mocap'/name) for name in ('mamma_pipeline.py','mamma_sam_frames.py','mamma_camera.py','mamma_gravity.py','mamma_gravity_worker.py','mamma_inputs.py','image_io.py','memory_mode.py','gpu_offload.py','worker_progress.py','runtime_registry.py','pear/alignment_support.py')}
+ from .resource_cache import code_hash
+ # Exact-byte aliases retain inference after the download-only progress fix.
+ identity['code']={name:(code_hash if name in {'mamma_pipeline.py','worker_progress.py'} else sha256)(ROOT/'mocap'/name) for name in ('mamma_pipeline.py','mamma_sam_frames.py','mamma_camera.py','mamma_gravity.py','mamma_gravity_worker.py','mamma_inputs.py','image_io.py','memory_mode.py','gpu_offload.py','worker_progress.py','runtime_registry.py','pear/alignment_support.py')}
token=hashlib.sha256(json.dumps(identity,sort_keys=True).encode()).hexdigest()[:24]
slot=job['root']/'mamma'/'inference'/token
cached=False
diff --git a/mocap/resource_cache.py b/mocap/resource_cache.py
index 08233dd..9cac129 100644
--- a/mocap/resource_cache.py
+++ b/mocap/resource_cache.py
@@ -27,6 +27,14 @@ LOGGING_ONLY = {
}
+# Download callback plumbing changes no MAMMA inference inputs.
+# These aliases match complete reviewed bytes, never arbitrary later edits.
+DOWNLOAD_PROGRESS_ONLY = {
+ "c3b12bed270ffea56272e750b234e06c6c49ce7eea980d0520dd0c8180c517aa": "e98a7df6d9396ee5d8ef9411b76cf899497f6c873955812b18b7439376da2e0d",
+ "8252ef60d906f1c36a8d3b832fbdf9da8204bedf66d3adecb55de52580121413": "5c90318cfc520bfad4f84d0239a47bdc38b95be14f2f3fc79baf9d9c7e9f32ba"
+}
+
+
def code_hash(path):
actual=sha256(path)
- return LOGGING_ONLY.get(actual,POLICY_ONLY.get(actual,actual))
+ return DOWNLOAD_PROGRESS_ONLY.get(actual,LOGGING_ONLY.get(actual,POLICY_ONLY.get(actual,actual)))
diff --git a/mocap/worker_progress.py b/mocap/worker_progress.py
index 0413907..efc80a8 100644
--- a/mocap/worker_progress.py
+++ b/mocap/worker_progress.py
@@ -1,5 +1,6 @@
"""Presentation-only worker entry; inference/cache identities stay unchanged."""
import json,runpy,sys
+from contextlib import contextmanager,nullcontext
for stream in (sys.stdout,sys.stderr):
if hasattr(stream,'reconfigure'):
@@ -10,6 +11,19 @@ def emit(kind,**value):
print('@@MOCAP@@'+json.dumps(dict(type=kind,**value)),flush=True)
+@contextmanager
+def download_progress(callback):
+ """Preserve the downloader signature, including recursive metadata calls."""
+ from . import models
+ original=models.download
+ def wrapped(key,progress=None):
+ return original(key,progress=callback if progress is None else progress)
+ try:
+ models.download=wrapped
+ yield
+ finally:models.download=original
+
+
def main():
stage=sys.argv[1] if len(sys.argv)>1 else ''
if stage in ('save_blend','save_blend_scene'):
@@ -57,13 +71,10 @@ def main():
from .project_save import main as save_main
sys.argv.pop(1)
return save_main(emit)
- if stage=='download':
- from . import models
- original=models.download
- models.download=lambda key:original(key,progress=emit)
if stage.startswith('exmr') or stage=='download':
from .progress_events import tqdm_events
- with tqdm_events(emit):runpy.run_module('mocap.worker',run_name='__main__')
+ with tqdm_events(emit), (download_progress(emit) if stage=='download' else nullcontext()):
+ runpy.run_module('mocap.worker',run_name='__main__')
else:runpy.run_module('mocap.worker',run_name='__main__')