fix(viz): load DETRPose config from src.core
CI build oscope-of / build-check (push) Has been cancelled

DETRPoseWorker._load_py_config imported LazyConfig from
src.misc.lazy_config, which the DETRPose repo does not expose (it lives
in src.core, as tools/inference/torch_inf.py uses it). The import raised
ImportError with no fallback, dropping into a hand-rolled exec() that
cannot resolve the lazy config's relative imports ("from .include..."),
so model loading died with KeyError "'__name__' not in globals". Try
src.core first, then the old path, before the exec fallback. DETRPose
now loads on macm1 (HGNetV2 backbone auto-downloads, no exception).
This commit is contained in:
L'électron rare
2026-06-26 16:44:35 +02:00
parent f504ad4f41
commit 32a4ef2232
+10 -5
View File
@@ -334,11 +334,16 @@ def _load_py_config(path: str):
from omegaconf import OmegaConf
# Les configs DETRPose sont des fichiers Python qui exposent un dict
# `model = LazyCall(...)`. On utilise le helper lazy_config si dispo.
try:
from src.misc.lazy_config import LazyConfig # type: ignore
return LazyConfig.load(path)
except ImportError:
pass
# DETRPose exposes LazyConfig from src.core (see tools/inference/torch_inf.py);
# the older src.misc.lazy_config path is kept as a fallback. LazyConfig.load
# handles the config's relative imports (`from .include...`) that a raw exec
# cannot.
for _mod in ("src.core", "src.misc.lazy_config"):
try:
mod = __import__(_mod, fromlist=["LazyConfig"])
return mod.LazyConfig.load(path)
except (ImportError, AttributeError):
continue
# Fallback minimal : exec + recup des noms cles.
ns: dict = {}
with open(path) as f: