Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mmengine/_strategy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Copy link

Copilot AI Oct 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition logic is inverted. When disable=True, not compile.get('disable', False) evaluates to False, preventing the early return. The condition should be compile.get('disable', False) (without not) to return the model when disable is True.

Suggested change
isinstance(compile, dict) and not compile.get('disable', False):
isinstance(compile, dict) and compile.get('disable', False):

Copilot uses AI. Check for mistakes.
return model

assert digit_version(TORCH_VERSION) >= digit_version('2.0.0'), (
Expand Down