Configure Debugger Using Amazon SageMaker Python SDK
To configure Debugger, use Amazon SageMaker Python SDKprofiler_config, debugger_hook_config, and
rules.
By default, Debugger monitors and debugs SageMaker training jobs without any Debugger-specific
parameters configured in SageMaker estimators. Debugger collects system metrics every
500
milliseconds and basic output tensors (scalar outputs such as loss and accuracy) every
500 steps. It also runs the ProfilerReport rule to analyze the system
metrics and aggregate the Studio Debugger insights dashboard and a profiling report.
Debugger saves the output data in your secured S3 bucket.
To use the new Debugger features, you need to upgrade the SageMaker Python SDK and
the
SMDebug client library. In your iPython kernel, Jupyter Notebook, or
JupyterLab environment, run the following code to install the latest versions of the
libraries and restart the kernel.
import sys import IPython !{sys.executable} -m pip install -U sagemaker smdebug IPython.Application.instance().kernel.do_shutdown(True)
Construct a SageMaker Estimator with Debugger
The following example codes show how to construct a SageMaker estimator with the Debugger-specific parameters depending on a framework of your choice. Throughout the documentation in the following topics, you can find more information about how to configure the Debugger-specific parameters that you can mix and match as you want.
The following example codes are not directly executable. You need to proceed to the next sections and configure the Debugger-specific parameters.
Where you configure the following parameters:
-
profiler_configparameter – Configure Debugger to collect system metrics and framework metrics from your training job and save into your secured S3 bucket URI or local machine. To learn how to configure theprofiler_configparameter, see Configure Debugger Monitoring Hardware System Resource Utilization and Configure Debugger Framework Profiling. -
debugger_hook_configparameter – Configure Debugger to collect output tensors from your training job and save into your secured S3 bucket URI or local machine. To learn how to configure thedebugger_hook_configparameter, see Configure Debugger Hook to Save Tensors. -
rulesparameter – Configure this parameter to enable Debugger built-in rules that you want to run in parallel. The rules automatically analyze your training job and find training issues. The ProfilerReport rule saves the Debugger profiling reports in your secured S3 bucket URI. To learn how to configure therulesparameter, see Configure Debugger Built-in Rules.
Debugger securely saves output data in subfolders of your default S3 bucket. For
example, the format of the default S3 bucket URI is
s3://sagemaker-<region>-<12digit_account_id>/<base-job-name>/<debugger-subfolders>/.
There are three subfolders created by Debugger: debug-output,
profiler-output, and rule-output. You can also retrieve
the default S3 bucket URIs using the SageMaker estimator classmethods.
See the following topics to find out how to configure the Debugger-specific parameters in detail.
Topics
- Configure Debugger Monitoring Hardware System Resource Utilization
- Configure Debugger Framework Profiling
- Updating Debugger System Monitoring and Framework Profiling Configuration while a Training Job is Running
- Configure Debugger Hook to Save Tensors
- Configure Debugger Built-in Rules
- Turn Off Debugger
- Useful SageMaker Estimator Classmethods for Debugger

