Skip to content

Disable Debugger When Checkpointing Is Enabled #2260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 8 additions & 1 deletion src/sagemaker/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2219,7 +2219,14 @@ def _validate_and_set_debugger_configs(self):
):
self.debugger_hook_config = DebuggerHookConfig(s3_output_path=self.output_path)
elif not self.debugger_hook_config:
self.debugger_hook_config = None
self.debugger_hook_config = False

# Disable debugger if checkpointing is enabled by the customer
if self.checkpoint_s3_uri and self.checkpoint_local_path and self.debugger_hook_config:
logger.info(
"SM Debug Does Not Currently Support Training Jobs With Checkpointing Enabled"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Can you make this sentence case instead of capitalizing each word?

)
self.debugger_hook_config = False

def _stage_user_code_in_s3(self):
"""Upload the user training script to s3 and return the location.
Expand Down
32 changes: 32 additions & 0 deletions tests/integ/test_debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,38 @@ def test_mxnet_with_debugger_hook_config(
_wait_and_assert_that_no_rule_jobs_errored(training_job=mx.latest_training_job)


def test_debug_hook_disabled_with_checkpointing(
sagemaker_session,
mxnet_training_latest_version,
mxnet_training_latest_py_version,
cpu_instance_type,
):
with timeout(minutes=TRAINING_DEFAULT_TIMEOUT_MINUTES):
s3_output_path = os.path.join(
"s3://", sagemaker_session.default_bucket(), str(uuid.uuid4())
)
debugger_hook_config = DebuggerHookConfig(
s3_output_path=os.path.join(s3_output_path, "tensors")
)

script_path = os.path.join(DATA_DIR, "mxnet_mnist", "mnist_gluon.py")

mx = MXNet(
entry_point=script_path,
role="SageMakerRole",
framework_version=mxnet_training_latest_version,
py_version=mxnet_training_latest_py_version,
instance_count=1,
instance_type=cpu_instance_type,
sagemaker_session=sagemaker_session,
debugger_hook_config=debugger_hook_config,
checkpoint_local_path="/opt/ml/checkpoints",
checkpoint_s3_uri=os.path.join(s3_output_path, "checkpoints"),
)
mx._prepare_for_training()
assert mx.debugger_hook_config is False


def test_mxnet_with_rules_and_debugger_hook_config(
sagemaker_session,
mxnet_training_latest_version,
Expand Down