From b63fd0d95b851cb364de274ad951d522a464e648 Mon Sep 17 00:00:00 2001 From: mgam <312065559@qq.com> Date: Sun, 26 Oct 2025 15:32:44 +0800 Subject: [PATCH 1/2] mmeng can now recognize `compile.disable` now. --- mmengine/_strategy/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mmengine/_strategy/base.py b/mmengine/_strategy/base.py index a713da9a70..f16acb1260 100644 --- a/mmengine/_strategy/base.py +++ b/mmengine/_strategy/base.py @@ -322,7 +322,8 @@ def compile_model( Returns: nn.Module: Compiled model. """ - if isinstance(compile, bool) and not compile: + if isinstance(compile, bool) and not compile or \ + isinstance(compile, dict) and not compile.get('disable', False): return model assert digit_version(TORCH_VERSION) >= digit_version('2.0.0'), ( From fce4f85da06b55b83b3cfeb55e0368a609bf85a8 Mon Sep 17 00:00:00 2001 From: ZhangYiqin <312065559@qq.com> Date: Sun, 26 Oct 2025 15:39:57 +0800 Subject: [PATCH 2/2] Fix logical error and improve readability Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- mmengine/_strategy/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmengine/_strategy/base.py b/mmengine/_strategy/base.py index f16acb1260..27ad74720a 100644 --- a/mmengine/_strategy/base.py +++ b/mmengine/_strategy/base.py @@ -322,8 +322,8 @@ def compile_model( Returns: nn.Module: Compiled model. """ - if isinstance(compile, bool) and not compile or \ - isinstance(compile, dict) and not compile.get('disable', False): + if (isinstance(compile, bool) and not compile) or \ + (isinstance(compile, dict) and compile.get('disable', False)): return model assert digit_version(TORCH_VERSION) >= digit_version('2.0.0'), (